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

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

Issue 1841853002: Fix summary detection of cycles via redirect/super arguments. (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 | « pkg/analyzer/lib/src/summary/link.dart ('k') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.test.src.summary.summary_common; 5 library analyzer.test.src.summary.summary_common;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 const C() : this.named(); 4219 const C() : this.named();
4220 const C.named() : super.named(); 4220 const C.named() : super.named();
4221 } 4221 }
4222 '''); 4222 ''');
4223 checkConstCycle('B', hasCycle: false); 4223 checkConstCycle('B', hasCycle: false);
4224 checkConstCycle('B', name: 'named', hasCycle: false); 4224 checkConstCycle('B', name: 'named', hasCycle: false);
4225 checkConstCycle('C', hasCycle: false); 4225 checkConstCycle('C', hasCycle: false);
4226 checkConstCycle('C', name: 'named', hasCycle: false); 4226 checkConstCycle('C', name: 'named', hasCycle: false);
4227 } 4227 }
4228 4228
4229 test_constructorCycle_viaRedirectArgument() {
4230 serializeLibraryText(
4231 '''
4232 class C {
4233 final x;
4234 const C() : this.named(y);
4235 const C.named(this.x);
4236 }
4237 const y = const C();
4238 ''',
4239 allowErrors: true);
4240 checkConstCycle('C');
4241 checkConstCycle('C', name: 'named', hasCycle: false);
4242 }
4243
4229 test_constructorCycle_viaStaticField_inOtherClass() { 4244 test_constructorCycle_viaStaticField_inOtherClass() {
4230 serializeLibraryText( 4245 serializeLibraryText(
4231 ''' 4246 '''
4232 class C { 4247 class C {
4233 final x; 4248 final x;
4234 const C() : x = D.y; 4249 const C() : x = D.y;
4235 } 4250 }
4236 class D { 4251 class D {
4237 static const y = const C(); 4252 static const y = const C();
4238 } 4253 }
4239 ''', 4254 ''',
4240 allowErrors: true); 4255 allowErrors: true);
4241 checkConstCycle('C'); 4256 checkConstCycle('C');
4242 } 4257 }
4243 4258
4244 test_constructorCycle_viaStaticField_inSameClass() { 4259 test_constructorCycle_viaStaticField_inSameClass() {
4245 serializeLibraryText( 4260 serializeLibraryText(
4246 ''' 4261 '''
4247 class C { 4262 class C {
4248 final x; 4263 final x;
4249 static const y = const C(); 4264 static const y = const C();
4250 const C() : x = y; 4265 const C() : x = y;
4251 } 4266 }
4252 ''', 4267 ''',
4253 allowErrors: true); 4268 allowErrors: true);
4254 checkConstCycle('C'); 4269 checkConstCycle('C');
4255 } 4270 }
4256 4271
4272 test_constructorCycle_viaSuperArgument() {
4273 serializeLibraryText(
4274 '''
4275 class B {
4276 final x;
4277 const B(this.x);
4278 }
4279 class C extends B {
4280 const C() : super(y);
4281 }
4282 const y = const C();
4283 ''',
4284 allowErrors: true);
4285 checkConstCycle('B', hasCycle: false);
4286 checkConstCycle('C');
4287 }
4288
4257 test_constructorCycle_viaSupertype() { 4289 test_constructorCycle_viaSupertype() {
4258 serializeLibraryText(''' 4290 serializeLibraryText('''
4259 class C { 4291 class C {
4260 final x; 4292 final x;
4261 const C() : x = const D(); 4293 const C() : x = const D();
4262 } 4294 }
4263 class D extends C { 4295 class D extends C {
4264 const D(); 4296 const D();
4265 } 4297 }
4266 '''); 4298 ''');
(...skipping 3962 matching lines...) Expand 10 before | Expand all | Expand 10 after
8229 class _PrefixExpectation { 8261 class _PrefixExpectation {
8230 final ReferenceKind kind; 8262 final ReferenceKind kind;
8231 final String name; 8263 final String name;
8232 final String absoluteUri; 8264 final String absoluteUri;
8233 final String relativeUri; 8265 final String relativeUri;
8234 final int numTypeParameters; 8266 final int numTypeParameters;
8235 8267
8236 _PrefixExpectation(this.kind, this.name, 8268 _PrefixExpectation(this.kind, this.name,
8237 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 8269 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
8238 } 8270 }
OLDNEW
« 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