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

Side by Side Diff: pkg/analyzer/test/src/summary/linker_test.dart

Issue 1895923003: Verify a corner case of const constructor cycle detection with summaires. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/src/summary/format.dart'; 5 import 'package:analyzer/src/summary/format.dart';
6 import 'package:analyzer/src/summary/link.dart'; 6 import 'package:analyzer/src/summary/link.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 import '../../reflective_tests.dart'; 9 import '../../reflective_tests.dart';
10 import 'summarize_ast_test.dart'; 10 import 'summarize_ast_test.dart';
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 class C extends B { 103 class C extends B {
104 var c; 104 var c;
105 } 105 }
106 '''); 106 ''');
107 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); 107 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
108 library.libraryCycleForLink.ensureLinked(); 108 library.libraryCycleForLink.ensureLinked();
109 // No assertions--just make sure it doesn't crash. 109 // No assertions--just make sure it doesn't crash.
110 } 110 }
111 111
112 void test_constCycle_viaLength() {
113 createLinker('''
114 class C {
115 final y;
116 const C() : y = x.length;
117 }
118 const x = [const C()];
119 ''');
120 testLibrary.libraryCycleForLink.ensureLinked();
121 ClassElementForLink classC = testLibrary.getContainedName('C');
122 expect(classC.unnamedConstructor.isCycleFree, false);
123 }
124
112 void test_inferredType_instanceField_dynamic() { 125 void test_inferredType_instanceField_dynamic() {
113 createLinker(''' 126 createLinker('''
114 var x; 127 var x;
115 class C { 128 class C {
116 var f = x; // Inferred type: dynamic 129 var f = x; // Inferred type: dynamic
117 } 130 }
118 '''); 131 ''');
119 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); 132 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
120 library.libraryCycleForLink.ensureLinked(); 133 library.libraryCycleForLink.ensureLinked();
121 ClassElementForLink_Class cls = library.getContainedName('C'); 134 ClassElementForLink_Class cls = library.getContainedName('C');
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 class C extends B with I {} 493 class C extends B with I {}
481 class D extends C { 494 class D extends C {
482 void f() {} 495 void f() {}
483 } 496 }
484 '''); 497 ''');
485 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); 498 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
486 library.libraryCycleForLink.ensureLinked(); 499 library.libraryCycleForLink.ensureLinked();
487 // No assertions--just make sure it doesn't crash. 500 // No assertions--just make sure it doesn't crash.
488 } 501 }
489 } 502 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698