Skip to content

No error in CFE for promoted type variable of wrong type #42089

Closed
@sgrekhov

Description

@sgrekhov

The code below produces compile-time error in analyzer and no issues in CFE

test<X>(X? x) {
  if (x is String?) {
    Object o = x; // Error in analyzer. A value of type 'X?' can't be assigned to a variable of type 'Object'
  }
}

main() {
  test<String>("");
}

If to remove if (x is String?) { from function test then CFE starts produce an error as well

Dart VM version: 2.9.0-11.0.dev (dev) (Tue May 26 12:14:57 2020 +0200) on "windows_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    NNBDIssues related to NNBD Releaselegacy-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