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

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

Issue 1493833003: Issue 25050. Fix for NPE in ConstantEvaluationEngine when duplicate fields. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 4392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 '''); 4403 ''');
4404 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); 4404 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
4405 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); 4405 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask);
4406 // validate 4406 // validate
4407 _fillErrorListener(VERIFY_ERRORS); 4407 _fillErrorListener(VERIFY_ERRORS);
4408 errorListener.assertErrorsWithCodes(<ErrorCode>[ 4408 errorListener.assertErrorsWithCodes(<ErrorCode>[
4409 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 4409 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
4410 ]); 4410 ]);
4411 } 4411 }
4412 4412
4413 test_perform_ConstantValidator_duplicateFields() {
4414 Source source = newSource(
4415 '/test.dart',
4416 '''
4417 class Test {
4418 final int x = 1;
4419 final int x = 2;
4420 const Test();
4421 }
4422
4423 main() {
4424 const Test();
4425 }
4426 ''');
4427 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
4428 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask);
4429 // validate
4430 _fillErrorListener(VERIFY_ERRORS);
4431 errorListener.assertNoErrors();
4432 }
4433
4413 test_perform_directiveError() { 4434 test_perform_directiveError() {
4414 Source source = newSource( 4435 Source source = newSource(
4415 '/test.dart', 4436 '/test.dart',
4416 ''' 4437 '''
4417 import 'no-such-file.dart'; 4438 import 'no-such-file.dart';
4418 '''); 4439 ''');
4419 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); 4440 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
4420 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); 4441 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask);
4421 // validate 4442 // validate
4422 _fillErrorListener(VERIFY_ERRORS); 4443 _fillErrorListener(VERIFY_ERRORS);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 /** 4585 /**
4565 * Fill [errorListener] with [result] errors in the current [task]. 4586 * Fill [errorListener] with [result] errors in the current [task].
4566 */ 4587 */
4567 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4588 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4568 List<AnalysisError> errors = task.outputs[result]; 4589 List<AnalysisError> errors = task.outputs[result];
4569 expect(errors, isNotNull, reason: result.name); 4590 expect(errors, isNotNull, reason: result.name);
4570 errorListener = new GatheringErrorListener(); 4591 errorListener = new GatheringErrorListener();
4571 errorListener.addAll(errors); 4592 errorListener.addAll(errors);
4572 } 4593 }
4573 } 4594 }
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