Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart |
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart |
index ccb9587d19588269d260d14d20633fd42bca4fba..3674d99ca25e4b8a474af8e74b15bba419f1dd11 100644 |
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart |
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart |
@@ -1913,6 +1913,33 @@ foo() { |
'''); |
} |
+ void test_inferDefaultFormalParameter() { |
+ var unit = checkFile(''' |
+f([x = 42]) {} |
+g({x: 'hi'}) {} |
+'''); |
+ expect(unit.functions[0].parameters[0].type.toString(), 'int'); |
+ expect(unit.functions[1].parameters[0].type.toString(), 'String'); |
+ } |
+ |
+ void test_inferDefaultFormalParameter_fieldFormal() { |
+ checkFile(''' |
+class C { |
+ int x; |
+ var y; |
+ C({this.x: /*error:INVALID_ASSIGNMENT*/0.0, this.y: 'hi'}) { |
+ String z = /*info:DYNAMIC_CAST*/y; |
+ } |
+ C.c([this.x =/*error:INVALID_ASSIGNMENT*/0.0, this.y = 'hi']) { |
+ String z = /*info:DYNAMIC_CAST*/y; |
+ } |
+ m() { |
+ String z = /*info:DYNAMIC_CAST*/y; |
+ } |
+} |
+'''); |
+ } |
+ |
void test_inferedType_usesSyntheticFunctionType() { |
var mainUnit = checkFile(''' |
int f() => null; |