| Summary: | Missing validation when returning a null literal to a non-nullable function return of type any | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Brian Svihovec <svihovec> |
| Component: | EDT | Assignee: | Project Inbox <edt.compiler-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | mheitz, pharmon, tww |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
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 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? The validation may be a bit inconsistant, but there is precidence for checking literal values. I think we should try to find as many errors as possible at compile time. Verified in Version: 0.8.0.v201203300902-1DV-FjuJ6QMOF4nynxT88h8G. |
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.