Skip to content

Turning reified types into legacy types for constant expressions #42262

Closed
@eernstg

Description

@eernstg

Thanks to @fishythefish for noting this. Consider the following program:

typedef T = int? Function();
const t = T;

void main() {
  print(T);
  print(t);
}

This prints () => int? and () => int with dart --enable-experiment=non-nullable --no-null-safety from c800b8d.

However, https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#const-evaluation-and-canonicalization only specifies that type arguments passed to collection literals and constant object expressions should be turned into legacy types in weak checking mode, but the above doesn't include any type arguments, and there does not seem to be a rule that turns function types into legacy types for constant expressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions