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

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

Issue 2656303004: Add a temporary analyzer error to work around #28515 (Closed)
Patch Set: Created 3 years, 10 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 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/src/error/codes.dart'; 10 import 'package:analyzer/src/error/codes.dart';
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 Source source = 2434 Source source =
2435 addSource("var b = const bool.fromEnvironment('x', defaultValue: 1);"); 2435 addSource("var b = const bool.fromEnvironment('x', defaultValue: 1);");
2436 await computeAnalysisResult(source); 2436 await computeAnalysisResult(source);
2437 assertErrors(source, [ 2437 assertErrors(source, [
2438 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, 2438 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
2439 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE 2439 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
2440 ]); 2440 ]);
2441 verify([source]); 2441 verify([source]);
2442 } 2442 }
2443 2443
2444 test_genericFunctionTypedParameter() async {
2445 // Once dartbug.com/28515 is fixed, this syntax should no longer generate an
2446 // error.
2447 // TODO(paulberry): When dartbug.com/28515 is fixed, convert this into a
2448 // NonErrorResolverTest.
2449 Source source = addSource('void g(T f<T>(T x)) {}');
2450 await computeAnalysisResult(source);
2451 var expectedErrorCodes = <ErrorCode>[
2452 CompileTimeErrorCode.GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED
2453 ];
2454 if (enableNewAnalysisDriver) {
2455 // Due to dartbug.com/28515, some additional errors appear when using the
2456 // new analysis driver.
2457 expectedErrorCodes.addAll([
2458 StaticWarningCode.UNDEFINED_CLASS,
2459 StaticWarningCode.UNDEFINED_CLASS
2460 ]);
2461 }
2462 assertErrors(source, expectedErrorCodes);
2463 verify([source]);
2464 }
2465
2466 test_genericFunctionTypedParameter_commentSyntax() async {
2467 // Once dartbug.com/28515 is fixed, this syntax should no longer generate an
2468 // error.
2469 // TODO(paulberry): When dartbug.com/28515 is fixed, convert this into a
2470 // NonErrorResolverTest.
2471 resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
2472 Source source = addSource('void g(/*=T*/ f/*<T>*/(/*=T*/ x)) {}');
2473 await computeAnalysisResult(source);
2474 var expectedErrorCodes = <ErrorCode>[
2475 CompileTimeErrorCode.GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED
2476 ];
2477 if (enableNewAnalysisDriver) {
2478 // Due to dartbug.com/28515, some additional errors appear when using the
2479 // new analysis driver.
2480 expectedErrorCodes.addAll([
2481 StaticWarningCode.UNDEFINED_CLASS,
2482 StaticWarningCode.UNDEFINED_CLASS
2483 ]);
2484 }
2485 assertErrors(source, expectedErrorCodes);
2486 verify([source]);
2487 }
2488
2444 test_getterAndMethodWithSameName() async { 2489 test_getterAndMethodWithSameName() async {
2445 Source source = addSource(r''' 2490 Source source = addSource(r'''
2446 class A { 2491 class A {
2447 x(y) {} 2492 x(y) {}
2448 get x => 0; 2493 get x => 0;
2449 }'''); 2494 }''');
2450 await computeAnalysisResult(source); 2495 await computeAnalysisResult(source);
2451 assertErrors( 2496 assertErrors(
2452 source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); 2497 source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]);
2453 verify([source]); 2498 verify([source]);
(...skipping 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6489 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6445 verify([source]); 6490 verify([source]);
6446 reset(); 6491 reset();
6447 } 6492 }
6448 6493
6449 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { 6494 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
6450 await _check_wrongNumberOfParametersForOperator(name, ""); 6495 await _check_wrongNumberOfParametersForOperator(name, "");
6451 await _check_wrongNumberOfParametersForOperator(name, "a, b"); 6496 await _check_wrongNumberOfParametersForOperator(name, "a, b");
6452 } 6497 }
6453 } 6498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698