Skip to content

Is "Never" is an object at runtime? #52961

Open
@matanlurey

Description

@matanlurey

No idea if this is expected (i.e. in the spec) or not, but it definitely confused me on #52962:

void main() {
  // error: Instance member 'hashCode' can't be accessed using static access.
  print(String.hashCode);
}
void main() {
  // error: Instance member 'hashCode' can't be accessed using static access.
  print(Null.hashCode);
}
void main() {
  // error: 79408728 on Dart2JS at the particular moment I ran this in DartPad
  print(Never.hashCode);
}

Both analyzer and compilers seem to accept this as valid.

Metadata

Metadata

Labels

P2A bug or feature request we're likely to work onlegacy-area-front-endLegacy: Use area-dart-model instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions