Skip to content

#2359. Fix existing extension types tests according to the new nullability rules #2372

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

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension type V1(int id) {}

extension type V2<T>(T id) {}

bool testAsInt(Object instance) {
bool testAsInt(Object? instance) {
try {
instance as int;
return true;
Expand Down
4 changes: 2 additions & 2 deletions LanguageFeatures/Extension-types/upper_bound_A01_t05.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension type ET4<T extends int>(T id) implements ET2<T?>, num {}

main() {
var v1 = 2 > 1 ? ET1<String>("String") : ET2<num>(1);
v1.expectStaticType<Exactly<Object>>();
v1.expectStaticType<Exactly<Object?>>();

var v2 = 2 > 1 ? ET1<String>("String") : ET2<String?>("String");
v2.expectStaticType<Exactly<Object?>>();
Expand All @@ -42,5 +42,5 @@ main() {
v5.expectStaticType<Exactly<ET1<String?>>>();

var v6 = 2 > 1 ? ET2<num>(4) : ET4(5);
v6.expectStaticType<Exactly<Object>>();
v6.expectStaticType<Exactly<Object?>>();
}
4 changes: 2 additions & 2 deletions LanguageFeatures/Extension-types/upper_bound_A01_t06.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ main() {
v3.expectStaticType<Exactly<String>>();

var v4 = 2 > 1 ? "String" : ET1<String>("ET1");
v4.expectStaticType<Exactly<Object>>();
v4.expectStaticType<Exactly<Object?>>();

var v5 = 2 > 1 ? "String" : ET1<String?>("ET1");
v5.expectStaticType<Exactly<Object?>>();

var v6 = 2 > 1 ? Object() : ET1<String>("ET1");
v6.expectStaticType<Exactly<Object>>();
v6.expectStaticType<Exactly<Object?>>();

var v7 = 2 > 1 ? Object() : ET1<String?>("ET1");
v7.expectStaticType<Exactly<Object?>>();
Expand Down