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

Side by Side Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 1841523003: Fix a corner case of constant evaluation cycle detection. (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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.non_error_resolver_test; 5 library analyzer.test.generated.non_error_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 void test_constNotInitialized_local() { 1470 void test_constNotInitialized_local() {
1471 Source source = addSource(r''' 1471 Source source = addSource(r'''
1472 main() { 1472 main() {
1473 const int x = 0; 1473 const int x = 0;
1474 }'''); 1474 }''');
1475 computeLibrarySourceErrors(source); 1475 computeLibrarySourceErrors(source);
1476 assertNoErrors(source); 1476 assertNoErrors(source);
1477 verify([source]); 1477 verify([source]);
1478 } 1478 }
1479 1479
1480 void test_constRedirectSkipsSupertype() {
1481 // Since C redirects to C.named, it doesn't implicitly refer to B's
1482 // unnamed constructor. Therefore there is no cycle.
1483 Source source = addSource('''
1484 class B {
1485 final x;
1486 const B() : x = y;
1487 const B.named() : x = null;
1488 }
1489 class C extends B {
1490 const C() : this.named();
1491 const C.named() : super.named();
1492 }
1493 const y = const C();
1494 ''');
1495 computeLibrarySourceErrors(source);
1496 assertNoErrors(source);
1497 verify([source]);
1498 }
1499
1480 void test_constructorDeclaration_scope_signature() { 1500 void test_constructorDeclaration_scope_signature() {
1481 Source source = addSource(r''' 1501 Source source = addSource(r'''
1482 const app = 0; 1502 const app = 0;
1483 class A { 1503 class A {
1484 A(@app int app) {} 1504 A(@app int app) {}
1485 }'''); 1505 }''');
1486 computeLibrarySourceErrors(source); 1506 computeLibrarySourceErrors(source);
1487 assertNoErrors(source); 1507 assertNoErrors(source);
1488 verify([source]); 1508 verify([source]);
1489 } 1509 }
(...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 reset(); 6088 reset();
6069 } 6089 }
6070 6090
6071 void _check_wrongNumberOfParametersForOperator1(String name) { 6091 void _check_wrongNumberOfParametersForOperator1(String name) {
6072 _check_wrongNumberOfParametersForOperator(name, "a"); 6092 _check_wrongNumberOfParametersForOperator(name, "a");
6073 } 6093 }
6074 6094
6075 CompilationUnit _getResolvedLibraryUnit(Source source) => 6095 CompilationUnit _getResolvedLibraryUnit(Source source) =>
6076 analysisContext.getResolvedCompilationUnit2(source, source); 6096 analysisContext.getResolvedCompilationUnit2(source, source);
6077 } 6097 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | tests/language/const_redirect_skips_supertype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698