OLD | NEW |
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 5233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 void test_typeAliasCannotReferenceItself_11987() { | 5244 void test_typeAliasCannotReferenceItself_11987() { |
5245 Source source = addSource(r''' | 5245 Source source = addSource(r''' |
5246 typedef void F(List<G> l); | 5246 typedef void F(List<G> l); |
5247 typedef void G(List<F> l); | 5247 typedef void G(List<F> l); |
5248 main() { | 5248 main() { |
5249 F foo(G g) => g; | 5249 F foo(G g) => g; |
5250 }'''); | 5250 }'''); |
5251 resolve(source); | 5251 resolve(source); |
5252 assertErrors(source, [ | 5252 assertErrors(source, [ |
5253 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, | 5253 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
5254 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, | 5254 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF |
5255 StaticTypeWarningCode.RETURN_OF_INVALID_TYPE | |
5256 ]); | 5255 ]); |
5257 verify([source]); | 5256 verify([source]); |
5258 } | 5257 } |
5259 | 5258 |
5260 void test_typeAliasCannotReferenceItself_19459() { | 5259 void test_typeAliasCannotReferenceItself_19459() { |
5261 // A complex example involving multiple classes. This is legal, since | 5260 // A complex example involving multiple classes. This is legal, since |
5262 // typedef F references itself only via a class. | 5261 // typedef F references itself only via a class. |
5263 Source source = addSource(r''' | 5262 Source source = addSource(r''' |
5264 class A<B, C> {} | 5263 class A<B, C> {} |
5265 abstract class D { | 5264 abstract class D { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5674 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 5673 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
5675 verify([source]); | 5674 verify([source]); |
5676 reset(); | 5675 reset(); |
5677 } | 5676 } |
5678 | 5677 |
5679 void _check_wrongNumberOfParametersForOperator1(String name) { | 5678 void _check_wrongNumberOfParametersForOperator1(String name) { |
5680 _check_wrongNumberOfParametersForOperator(name, ""); | 5679 _check_wrongNumberOfParametersForOperator(name, ""); |
5681 _check_wrongNumberOfParametersForOperator(name, "a, b"); | 5680 _check_wrongNumberOfParametersForOperator(name, "a, b"); |
5682 } | 5681 } |
5683 } | 5682 } |
OLD | NEW |