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

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

Issue 1946933002: Generalize ReferenceableElementForLink to work with explicit getters. (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 70f2b8a80fb1813289f9bcfc8103afc2e3d0795c..314cc4d3be2d9ee0b7d91580b0fbf8306da3edca 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2937,6 +2937,20 @@ final x = C.d.i;
expect(x.type.toString(), 'int');
}
+ void test_referenceToFieldOfStaticGetter() {
+ var mainUnit = checkFile('''
+class C {
+ static D get d => null;
+}
+class D {
+ int i;
+}
+final x = C.d.i;
+''');
+ var x = mainUnit.topLevelVariables[0];
+ expect(x.type.toString(), 'int');
+ }
+
void test_staticRefersToNonStaticField_inOtherLibraryCycle() {
addFile(
'''
@@ -2988,22 +3002,6 @@ 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 string of identifiers
- // 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
@@ -3023,6 +3021,22 @@ class D {
var a = mainUnit.topLevelVariables[0];
expect(a.type.toString(), 'dynamic');
}
+
+ void test_typeInferenceDependency_topLevelVariable_inIdentifierSequence() {
+ // Check that type inference dependencies are properly checked when a top
+ // level variable appears at the beginning of a string of identifiers
+ // 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.
+ }
}
@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