Skip to content

DDC function type typeTest throws #29913

Closed
@eernstg

Description

@eernstg

DDC in some cases generates code where a typeTest throws rather than returning false when the subtype relationship does not hold. The program is accepted by dartanalyzer --strong n016.dart with no issues.

class A {}
class B extends A {}
class C extends B {}

typedef B F(B b);

C foo(A a) => null;
A bar(C c) => null;

main() {
  print(foo is F); // 'true'.
  print(bar is F); // Throws!
}

When compiling and executing the program using dartdevc.dart from 5982ace, 2017-06-15 14:18:09, ddc n016.dart, the resulting output is as follows:

true

/usr/local/google/home/eernst/devel/dart/work/sdk/pkg/dev_compiler/lib/js/common/dart_sdk.js:9877
          throw e;
          ^
Strong mode is-check failure: (C) -> A does not soundly subtype F((B) -> B)

I would expect bar is F to evaluate to false rather than throwing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions