Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ddc] Incorrect subtype test between function type parameters #53175

Open
askeksa opened this issue Aug 10, 2023 · 1 comment
Open

[ddc] Incorrect subtype test between function type parameters #53175

askeksa opened this issue Aug 10, 2023 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler

Comments

@askeksa
Copy link
Contributor

askeksa commented Aug 10, 2023

The test added in https://dart-review.googlesource.com/c/sdk/+/319760 fails on ddc with:

Error: Expect.subtype<<A, B extends A>(A) => A, <A, B extends A>(B) => A>: <A, B extends A>(A) => A is not a subtype of <A, B extends A>(B) => A
@askeksa askeksa added web-dev-compiler area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Aug 10, 2023
@nshahan
Copy link
Contributor

nshahan commented Aug 10, 2023

This is fixed in DDC canary mode. The test passes with the new runtime type system.

@nshahan nshahan added the P3 A lower priority bug or feature request label Aug 18, 2023
copybara-service bot pushed a commit that referenced this issue Oct 12, 2023
The type normalization rules specify that `FutureOr<T>?` is normalized
to `FutureOr<T>` when `T` is nullable. However, it's more practical
for subtype testing if the declared nullability on the runtime
representation of the `FutureOr` type reflects the true nullability
(nullable if the `FutureOr` is declared nullable or its type argument
is nullable), rather than being normalized as per the spec.

This changes the static and dynamic normalization rules in dart2wasm
thus and compensates by computing the proper spec normalization when
the type is converted to a string.

The added test exposed a number of bugs in DDC and the VM:

#53175
#53737
#53738

Change-Id: I0ad0a09fe935ccbd3eb65e6958c958d29e0bb088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320821
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler
Projects
None yet
Development

No branches or pull requests

2 participants