blob: 73f816fce053d34f6dd741f3dd31a8a2d27d30a9 [file] [log] [blame]
library test;
import self as self;
import "dart:core" as core;
static method test() void {
{
function f<S extends core::Object>(core::int x) core::String
return null;
<S extends core::Object>(core::int) core::String v = f;
v = <T extends core::Object>(core::int x) core::String => null;
v = <T extends core::Object>(core::int x) core::String => "hello";
v = let final dynamic #t1 = <T extends core::Object>(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_generic_function_expressions.dart:14:65: Error: A value of type '<T extends dart.core::Object>(dart.core::String) \u8594 dart.core::String' can't be assigned to a variable of type '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\n v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=String*/ (String x) =>\n ^"));
v = let final dynamic #t2 = <T extends core::Object>(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_generic_function_expressions.dart:16:62: Error: A value of type '<T extends dart.core::Object>(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\n v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=int*/ (int x) => 3;\n ^"));
v = <T extends core::Object>(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_generic_function_expressions.dart:18: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 ^"));
};
}
{
function f<S extends core::Object>(core::int x) core::String
return null;
<S extends core::Object>(core::int) core::String v = f;
v = <T extends core::Object>(core::int x) core::String => null;
v = <T extends core::Object>(core::int x) core::String => "hello";
v = let final dynamic #t4 = <T extends core::Object>(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_generic_function_expressions.dart:27:36: Error: A value of type '<T extends dart.core::Object>(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\n T> /*@returnType=int*/ (/*@type=int*/ x) =>\n ^"));
v = <T extends core::Object>(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_generic_function_expressions.dart:30: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 ^"));
};
v = <T extends core::Object>(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_generic_function_expressions.dart:33: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 ^"));
};
}
{
function f<S extends core::Object>(core::int x) core::List<core::String>
return null;
<S extends core::Object>(core::int) core::List<core::String> v = f;
v = <T extends core::Object>(core::int x) core::List<core::String> => null;
v = <T extends core::Object>(core::int x) core::List<core::String> => <core::String>["hello"];
v = let final dynamic #t7 = <T extends core::Object>(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_generic_function_expressions.dart:43:71: Error: A value of type '<T extends dart.core::Object>(dart.core::String) \u8594 dart.core::List<dart.core::String>' can't be assigned to a variable of type '<S extends dart.core::Object>(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 '<S extends dart.core::Object>(dart.core::int) \u8594 dart.core::List<dart.core::String>'.\n v = /*error:INVALID_ASSIGNMENT*/ <T> /*@returnType=List<String>*/ (String\n ^"));
v = <T extends core::Object>(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_generic_function_expressions.dart:46:54: 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 ^"))];
v = <T extends core::Object>(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_generic_function_expressions.dart:50: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 ^"))];
};
}
{
function int2int<S extends core::Object>(core::int x) core::int
return null;
function int2String<T extends core::Object>(core::int x) core::String
return null;
function string2String<T extends core::Object>(core::String x) core::String
return null;
<S extends core::Object>(core::int) core::int x = int2int;
x = <T extends core::Object>(core::int x) core::int => x;
x = <T extends core::Object>(core::int x) core::int => x.{core::num::+}(1);
<T extends core::Object>(core::int) core::String y = int2String;
y = let final dynamic #t10 = <T extends core::Object>(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_generic_function_expressions.dart:63:36: Error: A value of type '<T extends dart.core::Object>(dart.core::int) \u8594 dart.core::int' can't be assigned to a variable of type '<T extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\nTry changing the type of the left hand side, or casting the right hand side to '<T extends dart.core::Object>(dart.core::int) \u8594 dart.core::String'.\n T> /*@returnType=int*/ (/*@type=int*/ x) =>\n ^"));
y = <T extends core::Object>(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_generic_function_expressions.dart:66:10: 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 ^"));
<T extends core::Object>(core::String) core::String z = string2String;
z = <T extends core::Object>(core::String x) core::String => x.{core::String::substring}(3);
}
}
static method main() dynamic {}