Issue Details (XML | Word | Printable)

Key: BOO-703
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Arron Washington
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Compiler warning on implicit return statement

Created: 20/Mar/06 01:48 PM   Updated: 23/Jan/09 08:37 AM   Resolved: 23/Jan/09 08:37 AM
Return to search
Component/s: Compiler
Affects Version/s: 0.8.2
Fix Version/s: 0.9

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide

The following code does not issue a compiler warning.

class freakyfred:
public X = 1

def dangerDoom(var as bool):
if var:
return freakyfred()

print dangerDoom(true) #not null
print dangerDoom(false) #null

Since the "default value" of a reference type is going to be null, this can be a serious ass-biter. Compiler warnings would be pleasant.



Daniel Grunwald added a comment - 21/Mar/06 01:57 AM

I would like to have this warning for value types, too.


Arron Washington added a comment - 21/Mar/06 05:24 PM

That brings up another topic: does anyone actively use this as a "feature" rather than a "safety net?"

A feature being intentional use, and a safety net meaning your code still compiles even though you forgot a return statement somewhere.


Rodrigo B. de Oliveira added a comment - 21/Mar/06 05:31 PM

I do.


Cedric Vivier made changes - 16/Jan/09 09:24 PM
Field Original Value New Value
Assignee Cedric Vivier [ cedricv ]
Cedric Vivier made changes - 16/Jan/09 09:26 PM
Link This issue is depended upon by BOO-1115 [ BOO-1115 ]
Cedric Vivier made changes - 16/Jan/09 09:27 PM
Affects Version/s 0.8.2 [ 13814 ]
Fix Version/s 0.9 [ 13816 ]
Rodrigo B. de Oliveira made changes - 22/Jan/09 09:24 AM
Fix Version/s 0.9 [ 13816 ]
Fix Version/s 0.9.1 [ 14922 ]
Cedric Vivier made changes - 23/Jan/09 07:08 AM
Summary Compiler warning on implicit return statement with reference type. Compiler warning on implicit return statement
Cedric Vivier added a comment - 23/Jan/09 08:37 AM

Landed in rev. 3181
Enabled in strict mode (or individually through Parameters.EnableWarning)


Cedric Vivier made changes - 23/Jan/09 08:37 AM
Resolution Fixed [ 1 ]
Fix Version/s 0.9.1 [ 14922 ]
Fix Version/s 0.9 [ 13816 ]
Status Open [ 1 ] Resolved [ 5 ]