-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cfe] Adjust nullability of FutureOrType after substitution
Bug: #48631 Change-Id: I329a70386d59425cf3f157dc4b6316649f8aa389 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240049 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Chloe Stefantsova <[email protected]>
- Loading branch information
1 parent
3436650
commit 7d8d3bb
Showing
19 changed files
with
377 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) 2022, 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 'dart:async'; | ||
|
||
FutureOr<T?> foo<T>(T t) {} | ||
|
||
bar<S>(bool t, S s) { | ||
var x = [foo(s), s]; | ||
} | ||
|
||
main() {} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue48631_1.dart.strong.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> {} | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic { | ||
core::List<FutureOr<self::bar::S?>?> x = <FutureOr<self::bar::S?>?>[self::foo<self::bar::S%>(s), s]; | ||
} | ||
static method main() → dynamic {} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue48631_1.dart.strong.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> {} | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic { | ||
core::List<FutureOr<self::bar::S?>?> x = core::_GrowableList::_literal2<FutureOr<self::bar::S?>?>(self::foo<self::bar::S%>(s), s); | ||
} | ||
static method main() → dynamic {} |
5 changes: 5 additions & 0 deletions
5
pkg/front_end/testcases/nnbd/issue48631_1.dart.textual_outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'dart:async'; | ||
|
||
FutureOr<T?> foo<T>(T t) {} | ||
bar<S>(bool t, S s) {} | ||
main() {} |
5 changes: 5 additions & 0 deletions
5
pkg/front_end/testcases/nnbd/issue48631_1.dart.textual_outline_modelled.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'dart:async'; | ||
|
||
FutureOr<T?> foo<T>(T t) {} | ||
bar<S>(bool t, S s) {} | ||
main() {} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue48631_1.dart.weak.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> {} | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic { | ||
core::List<FutureOr<self::bar::S?>?> x = <FutureOr<self::bar::S?>?>[self::foo<self::bar::S%>(s), s]; | ||
} | ||
static method main() → dynamic {} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue48631_1.dart.weak.modular.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> {} | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic { | ||
core::List<FutureOr<self::bar::S?>?> x = <FutureOr<self::bar::S?>?>[self::foo<self::bar::S%>(s), s]; | ||
} | ||
static method main() → dynamic {} |
12 changes: 12 additions & 0 deletions
12
pkg/front_end/testcases/nnbd/issue48631_1.dart.weak.outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> | ||
; | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic | ||
; | ||
static method main() → dynamic | ||
; |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue48631_1.dart.weak.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
static method foo<T extends core::Object? = dynamic>(self::foo::T% t) → FutureOr<self::foo::T?> {} | ||
static method bar<S extends core::Object? = dynamic>(core::bool t, self::bar::S% s) → dynamic { | ||
core::List<FutureOr<self::bar::S?>?> x = core::_GrowableList::_literal2<FutureOr<self::bar::S?>?>(self::foo<self::bar::S%>(s), s); | ||
} | ||
static method main() → dynamic {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2022, 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 'dart:async'; | ||
|
||
abstract class A { | ||
T foo<T>(B<T> b); | ||
} | ||
|
||
class B<X> { | ||
B(X x); | ||
} | ||
|
||
class C<Y> { | ||
final Bar<FutureOr<Y>, D<Y>> bar; | ||
|
||
C(this.bar); | ||
} | ||
|
||
abstract class D<W> implements A {} | ||
|
||
typedef Bar<V, U extends A> = V Function(U); | ||
|
||
final baz = C<int>((a) { | ||
return a.foo(B(Future.value(0))); | ||
}); | ||
|
||
main() {} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/nnbd/issue48631_2.dart.strong.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
import "dart:async" as asy; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
: super core::Object::•() | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
: self::C::bar = bar, super core::Object::•() | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
: super core::Object::•() | ||
; | ||
} | ||
static final field self::C<core::int> baz = new self::C::•<core::int>((self::D<core::int> a) → FutureOr<core::int> { | ||
return a.{self::A::foo}<FutureOr<core::int>>(new self::B::•<FutureOr<core::int>>(asy::Future::value<core::int>(0))){(self::B<FutureOr<core::int>>) → FutureOr<core::int>}; | ||
}); | ||
static method main() → dynamic {} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/nnbd/issue48631_2.dart.strong.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
import "dart:async" as asy; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
: super core::Object::•() | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
: self::C::bar = bar, super core::Object::•() | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
: super core::Object::•() | ||
; | ||
} | ||
static final field self::C<core::int> baz = new self::C::•<core::int>((self::D<core::int> a) → FutureOr<core::int> { | ||
return a.{self::A::foo}<FutureOr<core::int>>(new self::B::•<FutureOr<core::int>>(asy::Future::value<core::int>(0))){(self::B<FutureOr<core::int>>) → FutureOr<core::int>}; | ||
}); | ||
static method main() → dynamic {} |
22 changes: 22 additions & 0 deletions
22
pkg/front_end/testcases/nnbd/issue48631_2.dart.textual_outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'dart:async'; | ||
|
||
abstract class A { | ||
T foo<T>(B<T> b); | ||
} | ||
|
||
class B<X> { | ||
B(X x); | ||
} | ||
|
||
class C<Y> { | ||
final Bar<FutureOr<Y>, D<Y>> bar; | ||
C(this.bar); | ||
} | ||
|
||
abstract class D<W> implements A {} | ||
|
||
typedef Bar<V, U extends A> = V Function(U); | ||
final baz = C<int>((a) { | ||
return a.foo(B(Future.value(0))); | ||
}); | ||
main() {} |
22 changes: 22 additions & 0 deletions
22
pkg/front_end/testcases/nnbd/issue48631_2.dart.textual_outline_modelled.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'dart:async'; | ||
|
||
abstract class A { | ||
T foo<T>(B<T> b); | ||
} | ||
|
||
abstract class D<W> implements A {} | ||
|
||
class B<X> { | ||
B(X x); | ||
} | ||
|
||
class C<Y> { | ||
C(this.bar); | ||
final Bar<FutureOr<Y>, D<Y>> bar; | ||
} | ||
|
||
final baz = C<int>((a) { | ||
return a.foo(B(Future.value(0))); | ||
}); | ||
main() {} | ||
typedef Bar<V, U extends A> = V Function(U); |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/nnbd/issue48631_2.dart.weak.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
import "dart:async" as asy; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
: super core::Object::•() | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
: self::C::bar = bar, super core::Object::•() | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
: super core::Object::•() | ||
; | ||
} | ||
static final field self::C<core::int> baz = new self::C::•<core::int>((self::D<core::int> a) → FutureOr<core::int> { | ||
return a.{self::A::foo}<FutureOr<core::int>>(new self::B::•<FutureOr<core::int>>(asy::Future::value<core::int>(0))){(self::B<FutureOr<core::int>>) → FutureOr<core::int>}; | ||
}); | ||
static method main() → dynamic {} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/nnbd/issue48631_2.dart.weak.modular.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
import "dart:async" as asy; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
: super core::Object::•() | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
: self::C::bar = bar, super core::Object::•() | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
: super core::Object::•() | ||
; | ||
} | ||
static final field self::C<core::int> baz = new self::C::•<core::int>((self::D<core::int> a) → FutureOr<core::int> { | ||
return a.{self::A::foo}<FutureOr<core::int>>(new self::B::•<FutureOr<core::int>>(asy::Future::value<core::int>(0))){(self::B<FutureOr<core::int>>) → FutureOr<core::int>}; | ||
}); | ||
static method main() → dynamic {} |
28 changes: 28 additions & 0 deletions
28
pkg/front_end/testcases/nnbd/issue48631_2.dart.weak.outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
; | ||
} | ||
static final field self::C<core::int> baz; | ||
static method main() → dynamic | ||
; |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/nnbd/issue48631_2.dart.weak.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
import "dart:async" as asy; | ||
|
||
import "dart:async"; | ||
|
||
typedef Bar<V extends core::Object? = dynamic, contravariant U extends self::A> = (U) → V%; | ||
abstract class A extends core::Object { | ||
synthetic constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
abstract method foo<T extends core::Object? = dynamic>(self::B<self::A::foo::T%> b) → self::A::foo::T%; | ||
} | ||
class B<X extends core::Object? = dynamic> extends core::Object { | ||
constructor •(self::B::X% x) → self::B<self::B::X%> | ||
: super core::Object::•() | ||
; | ||
} | ||
class C<Y extends core::Object? = dynamic> extends core::Object { | ||
final field (self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar; | ||
constructor •((self::D<self::C::Y%>) → FutureOr<self::C::Y%>% bar) → self::C<self::C::Y%> | ||
: self::C::bar = bar, super core::Object::•() | ||
; | ||
} | ||
abstract class D<W extends core::Object? = dynamic> extends core::Object implements self::A { | ||
synthetic constructor •() → self::D<self::D::W%> | ||
: super core::Object::•() | ||
; | ||
} | ||
static final field self::C<core::int> baz = new self::C::•<core::int>((self::D<core::int> a) → FutureOr<core::int> { | ||
return a.{self::A::foo}<FutureOr<core::int>>(new self::B::•<FutureOr<core::int>>(asy::Future::value<core::int>(0))){(self::B<FutureOr<core::int>>) → FutureOr<core::int>}; | ||
}); | ||
static method main() → dynamic {} |
Oops, something went wrong.