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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_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/test/src/summary/linker_test.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 3ace67a4d18c8a0ee7c0113f9d68f892c311994a..08ee697112c7f6a232b2644ec0db395c96575992 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2372,6 +2372,69 @@ test() {
''');
}
+ void test_instanceField_basedOnInstanceField_betweenCycles() {
+ // Verify that all instance fields in one library cycle are inferred before
+ // an instance fields in a dependent library cycle.
+ addFile(
+ '''
+import 'b.dart';
+class A {
+ var x = new B().y;
+ var y = 0;
+}
+''',
+ name: '/a.dart');
+ addFile(
+ '''
+class B {
+ var x = new B().y;
+ var y = 0;
+}
+''',
+ name: '/b.dart');
+ checkFile('''
+import 'a.dart';
+import 'b.dart';
+main() {
+ new A().x = /*warning:INVALID_ASSIGNMENT*/'foo';
+ new B().x = 'foo';
+}
+''');
+ }
+
+ void test_instanceField_basedOnInstanceField_withinCycle() {
+ // Verify that all instance field inferences that occur within the same
+ // library cycle happen as though they occurred "all at once", so no
+ // instance field in the library cycle can inherit its type from another
+ // instance field in the same library cycle.
+ addFile(
+ '''
+import 'b.dart';
+class A {
+ var x = new B().y;
+ var y = 0;
+}
+''',
+ name: '/a.dart');
+ addFile(
+ '''
+import 'a.dart';
+class B {
+ var x = new A().y;
+ var y = 0;
+}
+''',
+ name: '/b.dart');
+ checkFile('''
+import 'a.dart';
+import 'b.dart';
+main() {
+ new A().x = 'foo';
+ new B().x = 'foo';
+}
+''');
+ }
+
void test_listLiterals() {
checkFile(r'''
test1() {
« no previous file with comments | « pkg/analyzer/test/src/summary/linker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698