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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1168563004: Fix a corner case of constant constructor dependency computation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/generated/constant.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 test.src.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 // When there is a circularity, all elements in the strongly connected 1488 // When there is a circularity, all elements in the strongly connected
1489 // component should be marked as having an error. 1489 // component should be marked as having an error.
1490 _checkCircularities('a', ['b', 'c', 'd'], ''' 1490 _checkCircularities('a', ['b', 'c', 'd'], '''
1491 const a = b; 1491 const a = b;
1492 const b = c + d; 1492 const b = c + d;
1493 const c = a; 1493 const c = a;
1494 const d = a; 1494 const d = a;
1495 '''); 1495 ''');
1496 } 1496 }
1497 1497
1498 test_const_constructor_calls_implicit_super_constructor_implicitly() {
1499 // Note: the situation below is a compile-time error (since the synthetic
1500 // constructor for Base is non-const), but we need to handle it without
1501 // throwing an exception.
1502 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue(
1503 'x', '''
1504 class Base {}
1505 class Derived extends Base {
1506 const Derived();
1507 }
1508 const x = const Derived();
1509 ''');
1510 expect(evaluationResult, isNotNull);
1511 }
1512
1498 test_dependency() { 1513 test_dependency() {
1499 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( 1514 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue(
1500 'x', ''' 1515 'x', '''
1501 const x = y + 1; 1516 const x = y + 1;
1502 const y = 1; 1517 const y = 1;
1503 '''); 1518 ''');
1504 expect(evaluationResult, isNotNull); 1519 expect(evaluationResult, isNotNull);
1505 expect(evaluationResult.value, isNotNull); 1520 expect(evaluationResult.value, isNotNull);
1506 expect(evaluationResult.value.intValue, 2); 1521 expect(evaluationResult.value.intValue, 2);
1507 } 1522 }
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 /** 2669 /**
2655 * Fill [errorListener] with [result] errors in the current [task]. 2670 * Fill [errorListener] with [result] errors in the current [task].
2656 */ 2671 */
2657 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 2672 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
2658 List<AnalysisError> errors = task.outputs[result]; 2673 List<AnalysisError> errors = task.outputs[result];
2659 expect(errors, isNotNull, reason: result.name); 2674 expect(errors, isNotNull, reason: result.name);
2660 errorListener = new GatheringErrorListener(); 2675 errorListener = new GatheringErrorListener();
2661 errorListener.addAll(errors); 2676 errorListener.addAll(errors);
2662 } 2677 }
2663 } 2678 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698