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

Unified Diff: pkg/analyzer/test/src/summary/linker_test.dart

Issue 1894263003: Clean up handling of declared/inferred types in VariableElementForLink (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') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/linker_test.dart
diff --git a/pkg/analyzer/test/src/summary/linker_test.dart b/pkg/analyzer/test/src/summary/linker_test.dart
index d7526aba95806367b99c7fdc098bfe3001b9feb3..e80e14f0850416b7ac16f4cabe73155c1ce2ed63 100644
--- a/pkg/analyzer/test/src/summary/linker_test.dart
+++ b/pkg/analyzer/test/src/summary/linker_test.dart
@@ -95,6 +95,19 @@ class C<T> extends B<T> {
// No assertions--just make sure it doesn't crash.
}
+ void test_baseClass_genericWithStaticFinal() {
+ createLinker('''
+class B<T> {
+ static final int i = 0;
+}
+class C<T> extends B<T> {
+ void f() {}
+}
+''');
+ LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
+ library.libraryCycleForLink.ensureLinked();
+ }
+
void test_baseClass_withPrivateField() {
createLinker('''
class B {
@@ -200,6 +213,7 @@ class C {
.getContainedName('C')
.getContainedName('y')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'dynamic');
@@ -215,6 +229,7 @@ var y = x;
.getLibrary(linkerInputs.testDartUri)
.getContainedName('y')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'dynamic');
@@ -237,6 +252,7 @@ var z = y; // Inferred type: dynamic
library
.getContainedName('z')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'dynamic');
@@ -260,11 +276,32 @@ var x = new C().f; // Inferred type: int
library
.getContainedName('x')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'int');
}
+ void test_inferredTypeFromOutsideBuildUnit_instanceField_toInstanceField() {
+ var bundle = createPackageBundle(
+ '''
+class C {
+ var f = 0; // Inferred type: int
+}
+''',
+ path: '/a.dart');
+ addBundle(bundle);
+ createLinker('''
+import 'a.dart';
+class D {
+ var g = new C().f; // Inferred type: int
+}
+''');
+ LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
+ ClassElementForLink_Class classD = library.getContainedName('D');
+ expect(classD.fields[0].inferredType.toString(), 'int');
+ }
+
void test_inferredTypeFromOutsideBuildUnit_methodParamType_viaGeneric() {
var bundle = createPackageBundle(
'''
@@ -286,6 +323,7 @@ var x = new C().f(0); // Inferred type: int
library
.getContainedName('x')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'int');
@@ -339,6 +377,7 @@ var x = new C().f(); // Inferred type: int
library
.getContainedName('x')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'int');
@@ -379,6 +418,7 @@ class D extends C {
.getLibrary(linkerInputs.testDartUri)
.getContainedName('x')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'int');
@@ -393,6 +433,7 @@ class D extends C {
.getLibrary(linkerInputs.testDartUri)
.getContainedName('b')
.asTypeInferenceNode
+ .variableElement
.inferredType
.toString(),
'int');
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698