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

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

Issue 688253004: Prevent conflict between parameter names and local function names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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/source_io.dart'; 7 import 'package:analyzer/src/generated/source_io.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 m() { 1184 m() {
1185 int a; 1185 int a;
1186 int a; 1186 int a;
1187 } 1187 }
1188 }'''); 1188 }''');
1189 resolve(source); 1189 resolve(source);
1190 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); 1190 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
1191 verify([source]); 1191 verify([source]);
1192 } 1192 }
1193 1193
1194 void test_duplicateDefinition_parameterWithFunctionName_local() {
1195 Source source = addSource(r'''
1196 main() {
1197 f(f) {}
1198 }''');
1199 resolve(source);
1200 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
1201 verify([source]);
1202 }
1203
1204 void test_duplicateDefinition_parameterWithFunctionName_topLevel() {
1205 Source source = addSource(r'''
1206 main() {
1207 f(f) {}
1208 }''');
1209 resolve(source);
1210 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
1211 verify([source]);
1212 }
1213
1214 void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() { 1194 void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() {
1215 Source source = addSource(r''' 1195 Source source = addSource(r'''
1216 class A { 1196 class A {
1217 int get x => 0; 1197 int get x => 0;
1218 } 1198 }
1219 class B extends A { 1199 class B extends A {
1220 static int get x => 0; 1200 static int get x => 0;
1221 }'''); 1201 }''');
1222 resolve(source); 1202 resolve(source);
1223 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE] ); 1203 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE] );
(...skipping 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after
4777 void _check_wrongNumberOfParametersForOperator1(String name) { 4757 void _check_wrongNumberOfParametersForOperator1(String name) {
4778 _check_wrongNumberOfParametersForOperator(name, ""); 4758 _check_wrongNumberOfParametersForOperator(name, "");
4779 _check_wrongNumberOfParametersForOperator(name, "a, b"); 4759 _check_wrongNumberOfParametersForOperator(name, "a, b");
4780 } 4760 }
4781 } 4761 }
4782 4762
4783 main() { 4763 main() {
4784 _ut.groupSep = ' | '; 4764 _ut.groupSep = ' | ';
4785 runReflectiveTests(CompileTimeErrorCodeTest); 4765 runReflectiveTests(CompileTimeErrorCodeTest);
4786 } 4766 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698