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

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

Issue 2401783002: Report CompileTimeErrorCode.DUPLICATE_PART when not only URI, but even Source is the same. (Closed)
Patch Set: Created 4 years, 2 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.compile_time_error_code_test; 5 library analyzer.test.generated.compile_time_error_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 Source source = addSource(r''' 1952 Source source = addSource(r'''
1953 f({a, b}) {} 1953 f({a, b}) {}
1954 main() { 1954 main() {
1955 f(a: 1, a: 2); 1955 f(a: 1, a: 2);
1956 }'''); 1956 }''');
1957 computeLibrarySourceErrors(source); 1957 computeLibrarySourceErrors(source);
1958 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); 1958 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
1959 verify([source]); 1959 verify([source]);
1960 } 1960 }
1961 1961
1962 void test_duplicatePart() { 1962 void test_duplicatePart_sameSource() {
1963 addNamedSource('/part.dart', 'part of lib;'); 1963 addNamedSource('/part.dart', 'part of lib;');
1964 Source source = addSource(r''' 1964 Source source = addSource(r'''
1965 library lib; 1965 library lib;
1966 part 'part.dart';
1967 part 'foo/../part.dart';
1968 ''');
1969 computeLibrarySourceErrors(source);
1970 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
1971 verify([source]);
1972 }
1973
1974 void test_duplicatePart_sameUri() {
1975 addNamedSource('/part.dart', 'part of lib;');
1976 Source source = addSource(r'''
1977 library lib;
1966 part 'part.dart'; 1978 part 'part.dart';
1967 part 'part.dart'; 1979 part 'part.dart';
1968 '''); 1980 ''');
1969 computeLibrarySourceErrors(source); 1981 computeLibrarySourceErrors(source);
1970 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]); 1982 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
1971 verify([source]); 1983 verify([source]);
1972 } 1984 }
1973 1985
1974 void test_exportInternalLibrary() { 1986 void test_exportInternalLibrary() {
1975 Source source = addSource("export 'dart:_interceptors';"); 1987 Source source = addSource("export 'dart:_interceptors';");
(...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after
6411 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6423 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6412 verify([source]); 6424 verify([source]);
6413 reset(); 6425 reset();
6414 } 6426 }
6415 6427
6416 void _check_wrongNumberOfParametersForOperator1(String name) { 6428 void _check_wrongNumberOfParametersForOperator1(String name) {
6417 _check_wrongNumberOfParametersForOperator(name, ""); 6429 _check_wrongNumberOfParametersForOperator(name, "");
6418 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6430 _check_wrongNumberOfParametersForOperator(name, "a, b");
6419 } 6431 }
6420 } 6432 }
OLDNEW
« pkg/analyzer/lib/src/task/dart.dart ('K') | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698