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
void main() { | |
String? x = test(null); | |
} | |
A test<A>(A a) => | |
switch((A,a.runtimeType)){ | |
(String,Null) => (){print("found nullable string"); return a;}(), | |
(String,_) => (){print("found nullable string"); return a;}(), | |
(String?,_) => (){print("found nullable string"); return a;}(), | |
(Type(),_) => (){print("failed to find nullable string for $A"); return a;}(), | |
}; |
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
void main() { | |
String? x = test(null); | |
String y = test("a"); | |
} | |
A test<A extends Object?>(A a) => | |
switch((A,a.runtimeType)){ | |
(String,Null) => (){print("found miscasted nullable string"); return a;}(), | |
(String,_) => (){print("found non-null string"); return a;}(), | |
(String?,_) => (){print("found nullable string"); return a;}(), |