Skip to content

Missing return statement does not trigger warning or error. #73

@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


What steps will reproduce the problem?

Type the following in try-dart-lang.appspot.com:

num foo() {
  print('Hello, world!');
}

main() {
  foo();
}

Or, even more egregiously:

num foo() {
  print('Hello, world!');
}

main() {
  num result = foo();
}

What is the expected output? What do you see instead?

Since the declaration of foo() promises to return an object of type 'num', there should, at the very least, be a warning triggered as a result of the lack of return. Ideally this would be an error.

Please provide any additional information below.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions