blob: aaba521c5c3d84002bd93771772705728f8439f8 [file] [log] [blame]
library test;
import self as self;
import "dart:core" as core;
typedef Function2<S extends core::Object, T extends core::Object> = (S) T;
static method test() void {
{
(core::int) core::String l0 = (core::int x) core::String => null;
(core::int) core::String l1 = (core::int x) core::String => "hello";
(core::int) core::String l2 = let final dynamic #t1 = (core::String x) → core::String => "hello" in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:15:66: Error: A value of type '(dart.core::String) \u8594 dart.core::String' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::String'.\n l2 = /*error:INVALID_ASSIGNMENT*/ /*@returnType=String*/ (String x) =>\n ^"));
(core::int) core::String l3 = let final dynamic #t2 = (core::int x) → core::int => 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:18:63: Error: A value of type '(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::String'.\n l3 = /*error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ (int x) => 3;\n ^"));
(core::int) core::String l4 = (core::int x) core::String {
return let final dynamic #t3 = 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:20:47: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n return /*error:RETURN_OF_INVALID_TYPE*/ 3;\n ^"));
};
}
{
(core::int) core::String l0 = (core::int x) core::String => null;
(core::int) core::String l1 = (core::int x) core::String => "hello";
(core::int) core::String l2 = let final dynamic #t4 = (core::int x) → core::int => 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:29:91: Error: A value of type '(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::String'.\n l2 = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ (/*@type=int*/ x) =>\n ^"));
(core::int) core::String l3 = (core::int x) core::String {
return let final dynamic #t5 = 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:32:47: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n return /*error:RETURN_OF_INVALID_TYPE*/ 3;\n ^"));
};
(core::int) core::String l4 = (core::int x) core::String {
return let final dynamic #t6 = x in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:35:47: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n return /*error:RETURN_OF_INVALID_TYPE*/ x;\n ^"));
};
}
{
(core::int) core::List<core::String> l0 = (core::int x) core::List<core::String> => null;
(core::int) core::List<core::String> l1 = (core::int x) core::List<core::String> => <core::String>["hello"];
(core::int) core::List<core::String> l2 = let final dynamic #t7 = (core::String x) → core::List<core::String> => <core::String>["hello"] in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:44:72: Error: A value of type '(dart.core::String) \u8594 dart.core::List<dart.core::String>' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::List<dart.core::String>'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::List<dart.core::String>'.\n l2 = /*error:INVALID_ASSIGNMENT*/ /*@returnType=List<String>*/ (String\n ^"));
(core::int) core::List<core::String> l3 = (core::int x) core::List<core::String> => <core::String>[let final dynamic #t8 = 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:48:58: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ 3\n ^"))];
(core::int) core::List<core::String> l4 = (core::int x) core::List<core::String> {
return <core::String>[let final dynamic #t9 = 3 in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:52:52: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ 3\n ^"))];
};
}
{
(core::int) core::int l0 = (core::int x) core::int => x;
(core::int) core::int l1 = (core::int x) core::int => x.{core::num::+}(1);
(core::int) core::String l2 = let final dynamic #t10 = (core::int x) → core::int => x in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:61:63: Error: A value of type '(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::String'.\n l2 = /*error:INVALID_ASSIGNMENT*/ /*@returnType=int*/ (/*@type=int*/ x) =>\n ^"));
(core::int) core::String l3 = (core::int x) core::String => let final dynamic #t11 = x in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/downwards_inference_on_function_expressions.dart:65:14: Error: The method 'substring' isn't defined for the class 'dart.core::int'.\nTry correcting the name to the name of an existing method, or defining a method named 'substring'.\n .substring(3);\n ^"));
(core::String) core::String l4 = (core::String x) core::String => x.{core::String::substring}(3);
}
}
static method main() dynamic {}