mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 06:20:13 +00:00
Issue 40764. Use Never instead of Null when converting super-bounded to regular-bounded.
Bug: https://github.com/dart-lang/sdk/issues/40764 Change-Id: I58f0e9860dd000aa2d8e416c5fce7e8964db0ef8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137280 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
9eeecae3e4
commit
0c7b9cf470
4 changed files with 26 additions and 1 deletions
|
@ -82,7 +82,7 @@ class DynamicTypeImpl extends TypeImpl {
|
|||
DartType replaceTopAndBottom(TypeProvider typeProvider,
|
||||
{bool isCovariant = true}) {
|
||||
if (isCovariant) {
|
||||
return typeProvider.nullType;
|
||||
return NeverTypeImpl.instance;
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -450,6 +450,14 @@ class B extends A {}
|
|||
main() {
|
||||
foo<B, A>();
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_superBounded() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
class A<X extends A<X>> {}
|
||||
|
||||
A get foo => throw 0;
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
|
12
tests/language/instantiate_to_bound/README.md
Normal file
12
tests/language/instantiate_to_bound/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Feature tests for instantiation to bounds, and super-bounded types
|
||||
|
||||
This directory was created in order to hold tests pertaining to the
|
||||
Dart feature _instantiate to bound_, which provides inference of
|
||||
default values for omitted type arguments. In order to handle
|
||||
F-bounded type parameters without introducing infinite types, this
|
||||
feature relies on another feature, _super-bounded types_, which is
|
||||
therefore also in focus for tests in this directory. For more details,
|
||||
please check the feature specifications on
|
||||
[super-bounded types](https://github.com/dart-lang/sdk/blob/master/docs/language/informal/super-bounded-types.md)
|
||||
and on
|
||||
[instantiate to bound](https://github.com/dart-lang/sdk/blob/master/docs/language/informal/instantiate-to-bound.md).
|
5
tests/language/instantiate_to_bound/issue40764_test.dart
Normal file
5
tests/language/instantiate_to_bound/issue40764_test.dart
Normal file
|
@ -0,0 +1,5 @@
|
|||
class A<X extends A<X>> {}
|
||||
|
||||
A get g => throw 0;
|
||||
|
||||
main() {}
|
Loading…
Reference in a new issue