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

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

Issue 1131383008: Generate the proper error when a constant refers to itself. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/task/driver.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | 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) 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 engine.compile_time_error_code_test; 5 library engine.compile_time_error_code_test;
6 6
7 import 'package:analyzer/src/generated/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
9 import 'package:analyzer/src/generated/source_io.dart'; 9 import 'package:analyzer/src/generated/source_io.dart';
10 import 'package:unittest/unittest.dart' as _ut; 10 import 'package:unittest/unittest.dart' as _ut;
(...skipping 4667 matching lines...) Expand 10 before | Expand all | Expand 10 after
4678 const C() : x = y; 4678 const C() : x = y;
4679 final x; 4679 final x;
4680 } 4680 }
4681 '''); 4681 ''');
4682 resolve(source); 4682 resolve(source);
4683 assertErrors( 4683 assertErrors(
4684 source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); 4684 source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
4685 verify([source]); 4685 verify([source]);
4686 } 4686 }
4687 4687
4688 void test_recursiveCompileTimeConstant_singleVariable() {
4689 Source source = addSource(r'''
4690 const x = x;
4691 ''');
4692 resolve(source);
4693 assertErrors(
4694 source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
4695 verify([source]);
4696 }
4697
4688 void test_recursiveConstructorRedirect() { 4698 void test_recursiveConstructorRedirect() {
4689 Source source = addSource(r''' 4699 Source source = addSource(r'''
4690 class A { 4700 class A {
4691 A.a() : this.b(); 4701 A.a() : this.b();
4692 A.b() : this.a(); 4702 A.b() : this.a();
4693 }'''); 4703 }''');
4694 resolve(source); 4704 resolve(source);
4695 assertErrors(source, [ 4705 assertErrors(source, [
4696 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, 4706 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
4697 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT 4707 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
5730 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 5740 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
5731 verify([source]); 5741 verify([source]);
5732 reset(); 5742 reset();
5733 } 5743 }
5734 5744
5735 void _check_wrongNumberOfParametersForOperator1(String name) { 5745 void _check_wrongNumberOfParametersForOperator1(String name) {
5736 _check_wrongNumberOfParametersForOperator(name, ""); 5746 _check_wrongNumberOfParametersForOperator(name, "");
5737 _check_wrongNumberOfParametersForOperator(name, "a, b"); 5747 _check_wrongNumberOfParametersForOperator(name, "a, b");
5738 } 5748 }
5739 } 5749 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/driver.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698