dart-sdk/tests/language/regress/regress46816_test.dart
Alexander Markov 3097b72b2b [vm] Ignore differences in generic-covariant-impl flags of type parameters when doing a subtype check
We might get different flags on lhs and rhs of a subtype check as
lhs might come from a tear-off which has generic-covariant-impl type
parameters and rhs is a standalone function type.

TEST=language/regress/regress46816_test
Fixes https://github.com/dart-lang/sdk/issues/46816

Change-Id: Ic0f1b4a9fdf0f4c9ae65c8c372d12c1e51ad8050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209265
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-07 21:03:46 +00:00

19 lines
479 B
Dart

// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:expect/expect.dart';
class A<X extends num> {
void f<Y extends X>(Y y) {}
}
typedef Func = void Function<Y extends int>(Y);
main() {
A<num> a = new A<int>();
dynamic f = (a as A<int>).f;
Expect.isTrue(f is Func);
print(f as Func);
}