Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368735 - Missing validation when returning a null literal to a non-nullable function return of type any
Summary: Missing validation when returning a null literal to a non-nullable function r...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-16 11:30 EST by Brian Svihovec CLA
Modified: 2017-02-23 14:20 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Svihovec CLA 2012-01-16 11:30:06 EST
Given the following EGL Source:

function getData()returns(any)
    	return (null);
    end

No validation message is reported to indicate that null can't be returned through a non-nullable return type.
Comment 1 Paul Harmon CLA 2012-02-23 12:50:17 EST
I have added the missing validation for passing a null to a non-nullable parm. I also added validation for the return statement, so that a function that is defined as returning a non-nullable cannot return a null literal.

The following were changed:

DefaultProblemRequestor
IProblemRequestor
EGLValidationResources.properties
FunctionArgumentValidator
ReturnStatementValidator
Comment 2 Brian Svihovec CLA 2012-02-23 13:23:51 EST
What is our general philosophy for validating literals?  Since we can't validate code that uses non-literals, I believe we have avoided validating literals in the past as well?
Comment 3 Paul Harmon CLA 2012-02-24 10:34:35 EST
The validation may be a bit inconsistant, but there is precidence for checking literal values.
Comment 4 Matt Heitz CLA 2012-02-24 10:38:30 EST
I think we should try to find as many errors as possible at compile time.
Comment 5 Brian Svihovec CLA 2012-04-02 13:09:00 EDT
Verified in Version: 0.8.0.v201203300902-1DV-FjuJ6QMOF4nynxT88h8G.