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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 1949833002: Fix a corner case of AST-based type inference with sequences of identifiers separated by '.'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/summary/link.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/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 ad5a7b144b1ee177a3e3402a8434085a9b179046..56355cca0747d5e17ae61fa4d91c181cb9b42fb2 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2987,6 +2987,42 @@ test() {
}
''');
}
+
+ void test_typeInferenceDependency_topLevelVariable_inIdentifierSequence() {
+ // Check that type inference dependencies are properly checked when a top
+ // level variable appears at the beginning of a strong of identifiers
scheglov 2016/05/03 23:35:16 "string of identifiers"
Paul Berry 2016/05/04 01:45:28 Done.
+ // separated by '.'.
+ var mainUnit = checkFile('''
+final a = /*info:DYNAMIC_INVOKE*/c.i;
+final c = new C(a);
+class C {
+ C(_);
+ int i;
+}
+''');
+ // No type should be inferred for a because there is a circular reference
+ // between a and c.
+ }
+
+ void test_typeInferenceDependency_staticVariable_inIdentifierSequence() {
+ // Check that type inference dependencies are properly checked when a static
+ // variable appears in the middle of a string of identifiers separated by
+ // '.'.
+ var mainUnit = checkFile('''
+final a = /*info:DYNAMIC_INVOKE*/C.d.i;
+class C {
+ static final d = new D(a);
+}
+class D {
+ D(_);
+ int i;
+}
+''');
+ // No type should be inferred for a because there is a circular reference
+ // between a and C.d.
+ var a = mainUnit.topLevelVariables[0];
+ expect(a.type.toString(), 'dynamic');
+ }
}
@reflectiveTest
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698