Skip to content

NNBD_TOP_MERGE(int?, int*) does not produce int? #40524

@iarkh

Description

@iarkh

Dart VM version: 2.8.0-edge.aadcb4418b1a7ccbb74a7cc925ad55020ce4a924 (Thu Feb 6 02:00:49 2020 +0000) on "linux_x64"

According to NNBD Spec:

NNBD_TOP_MERGE(T?, S*) = NNBD_TOP_MERGE(T, S)?
NNBD_TOP_MERGE(T*, S?) = NNBD_TOP_MERGE(T, S)?

In the following code source:
testlib_out.dart:

// @dart=2.6
class A<T> {
  Type getType() => T;
}

class out_int extends A<int> {}

test.dart:

import "testlib_out.dart";

class B extends A<int?> {}
class C extends out_int implements B {}

Type typeOf<X>() => X;

main() {
  print(typeOf<int?>() == C().getType());
}

direct super-interface type parameter of the class C should be int?.
However, this is not so and dart prints false here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NNBDIssues related to NNBD Releasearea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions