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

Unified Diff: pkg/analyzer/test/src/task/strong_mode_test.dart

Issue 1371813002: infer field formal parameter types (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong_mode_test.dart
diff --git a/pkg/analyzer/test/src/task/strong_mode_test.dart b/pkg/analyzer/test/src/task/strong_mode_test.dart
index d0c04a3306f3078780dff6517c651cb452a7f1c3..fbbbae61166ab40e8f747675a856a0bd6e22d9b1 100644
--- a/pkg/analyzer/test/src/task/strong_mode_test.dart
+++ b/pkg/analyzer/test/src/task/strong_mode_test.dart
@@ -958,6 +958,29 @@ class B<E> extends A<E> {
expect(methodB.type.typeArguments, [typeBE],
reason: 'function type should still have type arguments');
}
+
+ void test_inferCompilationUnit_fieldFormal() {
+ InstanceMemberInferrer inferrer = createInferrer;
+ String fieldName = 'f';
+ CompilationUnitElement unit = resolve('''
+class A {
+ final $fieldName = 0;
+ A([this.$fieldName = 'hello']);
+}
+''');
+ ClassElement classA = unit.getType('A');
+ FieldElement fieldA = classA.getField(fieldName);
+ FieldFormalParameterElement paramA =
+ classA.unnamedConstructor.parameters[0];
+ expect(fieldA.type.isDynamic, isTrue);
+ expect(paramA.type.isDynamic, isTrue);
+
+ inferrer.inferCompilationUnit(unit);
+
+ DartType intType = inferrer.typeProvider.intType;
+ expect(fieldA.type, intType);
+ expect(paramA.type, intType);
+ }
}
@reflectiveTest
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698