Boo

Compiler warning on implicit return statement

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.8.2
  • Fix Version/s: 0.9
  • Component/s: Compiler
  • Labels:
    None
  • Number of attachments :
    0

Description

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.

Issue Links

Activity

Hide
Daniel Grunwald added a comment -

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

Show
Daniel Grunwald added a comment - I would like to have this warning for value types, too.
Hide
Arron Washington added a comment -

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.

Show
Arron Washington added a comment - 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.
Hide
Rodrigo B. de Oliveira added a comment -

I do.

Show
Rodrigo B. de Oliveira added a comment - I do.
Hide
Cedric Vivier added a comment -

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

Show
Cedric Vivier added a comment - Landed in rev. 3181 Enabled in strict mode (or individually through Parameters.EnableWarning)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: