Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart

Issue 2925583003: Adjust expectations for parameterized closures to match front_end behavior. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart
diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart b/pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart
index 11bd1904385d42d70c3143ec558a3676082c4897..25163b0a748fd23dcc0876e08fcdcd25ccaae2bd 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart
+++ b/pkg/front_end/testcases/inference/downwards_inference_on_generic_function_expressions.dart
@@ -9,43 +9,43 @@ void main() {
{
String f<S>(int x) => null;
var /*@type=(int) -> String*/ v = f;
- v = /*@returnType=String*/ <T>(int x) => null;
- v = /*@returnType=String*/ <T>(int x) => "hello";
- v = /*error:INVALID_ASSIGNMENT*/ /*@returnType=String*/ <T>(String x) =>
+ v = <T> /*@returnType=String*/ (int x) => null;
+ v = <T> /*@returnType=String*/ (int x) => "hello";
+ v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=String*/ (String x) =>
"hello";
- v = /*error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ <T>(int x) => 3;
- v = /*@returnType=String*/ <T>(int x) {
+ v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=int*/ (int x) => 3;
+ v = <T> /*@returnType=String*/ (int x) {
return /*error:RETURN_OF_INVALID_TYPE*/ 3;
};
}
{
String f<S>(int x) => null;
var /*@type=(int) -> String*/ v = f;
- v = /*@returnType=String*/ <T>(/*@type=int*/ x) => null;
- v = /*@returnType=String*/ <T>(/*@type=int*/ x) => "hello";
- v = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ <
- T>(/*@type=int*/ x) =>
+ v = <T> /*@returnType=String*/ (/*@type=int*/ x) => null;
+ v = <T> /*@returnType=String*/ (/*@type=int*/ x) => "hello";
+ v = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/ <
+ T> /*@returnType=int*/ (/*@type=int*/ x) =>
3;
- v = /*@returnType=String*/ <T>(/*@type=int*/ x) {
+ v = <T> /*@returnType=String*/ (/*@type=int*/ x) {
return /*error:RETURN_OF_INVALID_TYPE*/ 3;
};
- v = /*@returnType=String*/ <T>(/*@type=int*/ x) {
+ v = <T> /*@returnType=String*/ (/*@type=int*/ x) {
return /*error:RETURN_OF_INVALID_TYPE*/ x;
};
}
{
List<String> f<S>(int x) => null;
var /*@type=(int) -> List<String>*/ v = f;
- v = /*@returnType=List<String>*/ <T>(int x) => null;
- v = /*@returnType=List<String>*/ <T>(int x) => /*@typeArgs=String*/ [
+ v = <T> /*@returnType=List<String>*/ (int x) => null;
+ v = <T> /*@returnType=List<String>*/ (int x) => /*@typeArgs=String*/ [
"hello"
];
- v = /*error:INVALID_ASSIGNMENT*/ /*@returnType=List<String>*/ <
- T>(String x) => /*@typeArgs=String*/ ["hello"];
- v = /*@returnType=List<String>*/ <T>(int x) => /*@typeArgs=String*/ [
+ v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=List<String>*/ (String
+ x) => /*@typeArgs=String*/ ["hello"];
+ v = <T> /*@returnType=List<String>*/ (int x) => /*@typeArgs=String*/ [
/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ 3
];
- v = /*@returnType=List<String>*/ <T>(int x) {
+ v = <T> /*@returnType=List<String>*/ (int x) {
return /*@typeArgs=String*/ [
/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ 3
];
@@ -56,16 +56,16 @@ void main() {
String int2String<T>(int x) => null;
String string2String<T>(String x) => null;
var /*@type=(int) -> int*/ x = int2int;
- x = /*@returnType=int*/ <T>(/*@type=int*/ x) => x;
- x = /*@returnType=int*/ <T>(/*@type=int*/ x) => x /*@target=num::+*/ + 1;
+ x = <T> /*@returnType=int*/ (/*@type=int*/ x) => x;
+ x = <T> /*@returnType=int*/ (/*@type=int*/ x) => x /*@target=num::+*/ + 1;
var /*@type=(int) -> String*/ y = int2String;
- y = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ <
- T>(/*@type=int*/ x) =>
+ y = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/ <
+ T> /*@returnType=int*/ (/*@type=int*/ x) =>
x;
- y = /*@returnType=String*/ <
- T>(/*@type=int*/ x) => /*info:DYNAMIC_INVOKE, info:DYNAMIC_CAST*/ x.substring(3);
+ y = <T> /*@returnType=String*/ (/*@type=int*/ x) => /*info:DYNAMIC_INVOKE, info:DYNAMIC_CAST*/ x
+ .substring(3);
var /*@type=(String) -> String*/ z = string2String;
- z = /*@returnType=String*/ <T>(/*@type=String*/ x) =>
+ z = <T> /*@returnType=String*/ (/*@type=String*/ x) =>
x. /*@target=String::substring*/ substring(3);
}
}

Powered by Google App Engine
This is Rietveld 408576698