| Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| index ea8ca17d152d1e4016e71dac51a01dc971d6c439..454595b81e4ab67b9fad2356c8ef5d2b3ec670f7 100644
|
| --- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| @@ -4,6 +4,8 @@
|
|
|
| library analyzer.test.generated.compile_time_error_code_test;
|
|
|
| +import 'dart:async';
|
| +
|
| import 'package:analyzer/error/error.dart';
|
| import 'package:analyzer/src/error/codes.dart';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| @@ -22,7 +24,7 @@ main() {
|
|
|
| @reflectiveTest
|
| class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| - void fail_awaitInWrongContext_sync() {
|
| + fail_awaitInWrongContext_sync() async {
|
| // This test requires better error recovery than we currently have. In
|
| // particular, we need to be able to distinguish between an await expression
|
| // in the wrong context, and the use of 'await' as an identifier.
|
| @@ -30,11 +32,11 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| f(x) {
|
| return await x;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| + await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_awaitInWrongContext_syncStar() {
|
| + fail_awaitInWrongContext_syncStar() async {
|
| // This test requires better error recovery than we currently have. In
|
| // particular, we need to be able to distinguish between an await expression
|
| // in the wrong context, and the use of 'await' as an identifier.
|
| @@ -42,22 +44,22 @@ f(x) {
|
| f(x) sync* {
|
| yield await x;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| + await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_constEvalThrowsException() {
|
| + fail_constEvalThrowsException() async {
|
| Source source = addSource(r'''
|
| class C {
|
| const C();
|
| }
|
| f() { return const C(); }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_invalidIdentifierInAsync_async() {
|
| + fail_invalidIdentifierInAsync_async() async {
|
| // TODO(brianwilkerson) Report this error.
|
| Source source = addSource(r'''
|
| class A {
|
| @@ -65,11 +67,12 @@ class A {
|
| int async;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_invalidIdentifierInAsync_await() {
|
| + fail_invalidIdentifierInAsync_await() async {
|
| // TODO(brianwilkerson) Report this error.
|
| Source source = addSource(r'''
|
| class A {
|
| @@ -77,11 +80,12 @@ class A {
|
| int await;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_invalidIdentifierInAsync_yield() {
|
| + fail_invalidIdentifierInAsync_yield() async {
|
| // TODO(brianwilkerson) Report this error.
|
| Source source = addSource(r'''
|
| class A {
|
| @@ -89,99 +93,105 @@ class A {
|
| int yield;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_mixinDeclaresConstructor() {
|
| + fail_mixinDeclaresConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() {}
|
| }
|
| class B extends Object mixin A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_mixinOfNonClass() {
|
| + fail_mixinOfNonClass() async {
|
| // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
|
| Source source = addSource(r'''
|
| var A;
|
| class B extends Object mixin A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_objectCannotExtendAnotherClass() {
|
| + fail_objectCannotExtendAnotherClass() async {
|
| Source source = addSource(r'''
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_superInitializerInObject() {
|
| + fail_superInitializerInObject() async {
|
| Source source = addSource(r'''
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_yieldEachInNonGenerator_async() {
|
| + fail_yieldEachInNonGenerator_async() async {
|
| // TODO(brianwilkerson) We are currently parsing the yield statement as a
|
| // binary expression.
|
| Source source = addSource(r'''
|
| f() async {
|
| yield* 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_yieldEachInNonGenerator_sync() {
|
| + fail_yieldEachInNonGenerator_sync() async {
|
| // TODO(brianwilkerson) We are currently parsing the yield statement as a
|
| // binary expression.
|
| Source source = addSource(r'''
|
| f() {
|
| yield* 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| + await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_yieldInNonGenerator_async() {
|
| + fail_yieldInNonGenerator_async() async {
|
| // TODO(brianwilkerson) We are currently trying to parse the yield statement
|
| // as a binary expression.
|
| Source source = addSource(r'''
|
| f() async {
|
| yield 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| + await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void fail_yieldInNonGenerator_sync() {
|
| + fail_yieldInNonGenerator_sync() async {
|
| // TODO(brianwilkerson) We are currently trying to parse the yield statement
|
| // as a binary expression.
|
| Source source = addSource(r'''
|
| f() {
|
| yield 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_accessPrivateEnumField() {
|
| + test_accessPrivateEnumField() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| String name(E e) {
|
| return e._name;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]);
|
| // Cannot verify because "_name" cannot be resolved.
|
| }
|
|
|
| - void test_ambiguousExport() {
|
| + test_ambiguousExport() async {
|
| Source source = addSource(r'''
|
| library L;
|
| export 'lib1.dart';
|
| @@ -196,11 +206,11 @@ class N {}''');
|
| r'''
|
| library lib2;
|
| class N {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
|
| + await assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_annotationWithNotClass() {
|
| + test_annotationWithNotClass() async {
|
| Source source = addSource('''
|
| class Property {
|
| final int value;
|
| @@ -213,11 +223,12 @@ const Property property = const Property(42);
|
| main() {
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_annotationWithNotClass_prefixed() {
|
| + test_annotationWithNotClass_prefixed() async {
|
| addNamedSource(
|
| "/annotations.dart",
|
| r'''
|
| @@ -234,11 +245,12 @@ import 'annotations.dart' as pref;
|
| main() {
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_annotation() {
|
| + test_async_used_as_identifier_in_annotation() async {
|
| Source source = addSource('''
|
| const int async = 0;
|
| f() async {
|
| @@ -246,11 +258,12 @@ f() async {
|
| g(0);
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_argument_label() {
|
| + test_async_used_as_identifier_in_argument_label() async {
|
| Source source = addSource('''
|
| @proxy
|
| class C {}
|
| @@ -258,32 +271,35 @@ f() async {
|
| new C().g(async: 0);
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| // Note: we don't call verify([source]) because verify() doesn't understand
|
| // about @proxy.
|
| }
|
|
|
| - void test_async_used_as_identifier_in_async_method() {
|
| + test_async_used_as_identifier_in_async_method() async {
|
| Source source = addSource('''
|
| f() async {
|
| var async = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_async_star_method() {
|
| + test_async_used_as_identifier_in_async_star_method() async {
|
| Source source = addSource('''
|
| f() async* {
|
| var async = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_break_statement() {
|
| + test_async_used_as_identifier_in_break_statement() async {
|
| Source source = addSource('''
|
| f() async {
|
| while (true) {
|
| @@ -291,7 +307,7 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
|
| CompileTimeErrorCode.LABEL_UNDEFINED
|
| ]);
|
| @@ -299,7 +315,7 @@ f() async {
|
| // "async" label is unresolved.
|
| }
|
|
|
| - void test_async_used_as_identifier_in_cascaded_invocation() {
|
| + test_async_used_as_identifier_in_cascaded_invocation() async {
|
| Source source = addSource('''
|
| class C {
|
| int async() => 1;
|
| @@ -308,11 +324,12 @@ f() async {
|
| return new C()..async();
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_cascaded_setter_invocation() {
|
| + test_async_used_as_identifier_in_cascaded_setter_invocation() async {
|
| Source source = addSource('''
|
| class C {
|
| void set async(int i) {}
|
| @@ -321,11 +338,12 @@ f() async {
|
| return new C()..async = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_catch_exception_argument() {
|
| + test_async_used_as_identifier_in_catch_exception_argument() async {
|
| Source source = addSource('''
|
| g() {}
|
| f() async {
|
| @@ -334,11 +352,12 @@ f() async {
|
| } catch (async) { }
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_catch_stacktrace_argument() {
|
| + test_async_used_as_identifier_in_catch_stacktrace_argument() async {
|
| Source source = addSource('''
|
| g() {}
|
| f() async {
|
| @@ -347,11 +366,12 @@ f() async {
|
| } catch (e, async) { }
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_continue_statement() {
|
| + test_async_used_as_identifier_in_continue_statement() async {
|
| Source source = addSource('''
|
| f() async {
|
| while (true) {
|
| @@ -359,7 +379,7 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
|
| CompileTimeErrorCode.LABEL_UNDEFINED
|
| ]);
|
| @@ -367,29 +387,31 @@ f() async {
|
| // "async" label is unresolved.
|
| }
|
|
|
| - void test_async_used_as_identifier_in_for_statement() {
|
| + test_async_used_as_identifier_in_for_statement() async {
|
| Source source = addSource('''
|
| var async;
|
| f() async {
|
| for (async in []) {}
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_formal_parameter_name() {
|
| + test_async_used_as_identifier_in_formal_parameter_name() async {
|
| Source source = addSource('''
|
| f() async {
|
| g(int async) {}
|
| g(0);
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_getter_name() {
|
| + test_async_used_as_identifier_in_getter_name() async {
|
| Source source = addSource('''
|
| class C {
|
| int get async => 1;
|
| @@ -398,11 +420,12 @@ f() async {
|
| return new C().async;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_invocation() {
|
| + test_async_used_as_identifier_in_invocation() async {
|
| Source source = addSource('''
|
| class C {
|
| int async() => 1;
|
| @@ -411,32 +434,35 @@ f() async {
|
| return new C().async();
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_local_function_name() {
|
| + test_async_used_as_identifier_in_local_function_name() async {
|
| Source source = addSource('''
|
| f() async {
|
| int async() => null;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_prefix() {
|
| + test_async_used_as_identifier_in_prefix() async {
|
| Source source = addSource('''
|
| import 'dart:async' as async;
|
| f() async {
|
| return new async.Future.value(0);
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_setter_name() {
|
| + test_async_used_as_identifier_in_setter_name() async {
|
| Source source = addSource('''
|
| class C {
|
| void set async(int i) {}
|
| @@ -445,33 +471,36 @@ f() async {
|
| new C().async = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_statement_label() {
|
| + test_async_used_as_identifier_in_statement_label() async {
|
| Source source = addSource('''
|
| f() async {
|
| async: g();
|
| }
|
| g() {}
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_string_interpolation() {
|
| + test_async_used_as_identifier_in_string_interpolation() async {
|
| Source source = addSource(r'''
|
| int async = 1;
|
| f() async {
|
| return "$async";
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_suffix() {
|
| + test_async_used_as_identifier_in_suffix() async {
|
| addNamedSource(
|
| "/lib1.dart",
|
| r'''
|
| @@ -484,11 +513,12 @@ f() async {
|
| return l.async;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_switch_label() {
|
| + test_async_used_as_identifier_in_switch_label() async {
|
| Source source = addSource('''
|
| f() async {
|
| switch (0) {
|
| @@ -496,61 +526,67 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_async_used_as_identifier_in_sync_star_method() {
|
| + test_async_used_as_identifier_in_sync_star_method() async {
|
| Source source = addSource('''
|
| f() sync* {
|
| var async = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_asyncForInWrongContext() {
|
| + test_asyncForInWrongContext() async {
|
| Source source = addSource(r'''
|
| f(list) {
|
| await for (var e in list) {
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_await_used_as_identifier_in_async_method() {
|
| + test_await_used_as_identifier_in_async_method() async {
|
| Source source = addSource('''
|
| f() async {
|
| var await = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_await_used_as_identifier_in_async_star_method() {
|
| + test_await_used_as_identifier_in_async_star_method() async {
|
| Source source = addSource('''
|
| f() async* {
|
| var await = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_await_used_as_identifier_in_sync_star_method() {
|
| + test_await_used_as_identifier_in_sync_star_method() async {
|
| Source source = addSource('''
|
| f() sync* {
|
| var await = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_bug_23176() {
|
| + test_bug_23176() async {
|
| Source source = addSource('''
|
| class A {
|
| const A([x]);
|
| @@ -559,72 +595,75 @@ class B {
|
| dynamic @A(const A()) x;
|
| }
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| ParserErrorCode.EXPECTED_CLASS_MEMBER,
|
| ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsMixinName_classTypeAlias() {
|
| + test_builtInIdentifierAsMixinName_classTypeAlias() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B {}
|
| class as = A with B;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsType_formalParameter_field() {
|
| + test_builtInIdentifierAsType_formalParameter_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var x;
|
| A(static this.x);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsType_formalParameter_simple() {
|
| + test_builtInIdentifierAsType_formalParameter_simple() async {
|
| Source source = addSource(r'''
|
| f(static x) {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsType_variableDeclaration() {
|
| + test_builtInIdentifierAsType_variableDeclaration() async {
|
| Source source = addSource(r'''
|
| f() {
|
| typedef x;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsTypedefName_functionTypeAlias() {
|
| + test_builtInIdentifierAsTypedefName_functionTypeAlias() async {
|
| Source source = addSource("typedef bool as();");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsTypeName() {
|
| + test_builtInIdentifierAsTypeName() async {
|
| Source source = addSource("class as {}");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_builtInIdentifierAsTypeParameterName() {
|
| + test_builtInIdentifierAsTypeParameterName() async {
|
| Source source = addSource("class A<as> {}");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_caseExpressionTypeImplementsEquals() {
|
| + test_caseExpressionTypeImplementsEquals() async {
|
| Source source = addSource(r'''
|
| class IntWrapper {
|
| final int value;
|
| @@ -641,34 +680,34 @@ f(var a) {
|
| default: return 0;
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingConstructorNameAndMember_field() {
|
| + test_conflictingConstructorNameAndMember_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A.x() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingConstructorNameAndMember_method() {
|
| + test_conflictingConstructorNameAndMember_method() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A.x();
|
| void x() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingGetterAndMethod_field_method() {
|
| + test_conflictingGetterAndMethod_field_method() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final int m = 0;
|
| @@ -676,11 +715,12 @@ class A {
|
| class B extends A {
|
| m() {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingGetterAndMethod_getter_method() {
|
| + test_conflictingGetterAndMethod_getter_method() async {
|
| Source source = addSource(r'''
|
| class A {
|
| get m => 0;
|
| @@ -688,11 +728,12 @@ class A {
|
| class B extends A {
|
| m() {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingGetterAndMethod_method_field() {
|
| + test_conflictingGetterAndMethod_method_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -700,11 +741,12 @@ class A {
|
| class B extends A {
|
| int m;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingGetterAndMethod_method_getter() {
|
| + test_conflictingGetterAndMethod_method_getter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -712,70 +754,71 @@ class A {
|
| class B extends A {
|
| get m => 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndClass() {
|
| + test_conflictingTypeVariableAndClass() async {
|
| Source source = addSource(r'''
|
| class T<T> {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndMember_field() {
|
| + test_conflictingTypeVariableAndMember_field() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| var T;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndMember_getter() {
|
| + test_conflictingTypeVariableAndMember_getter() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| get T => null;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndMember_method() {
|
| + test_conflictingTypeVariableAndMember_method() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| T() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndMember_method_static() {
|
| + test_conflictingTypeVariableAndMember_method_static() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| static T() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_conflictingTypeVariableAndMember_setter() {
|
| + test_conflictingTypeVariableAndMember_setter() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| set T(x) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_consistentCaseExpressionTypes_dynamic() {
|
| + test_consistentCaseExpressionTypes_dynamic() async {
|
| // Even though A.S and S have a static type of "dynamic", we should see
|
| // that they match 'abc', because they are constant strings.
|
| Source source = addSource(r'''
|
| @@ -795,11 +838,11 @@ foo(var p) {
|
| break;
|
| }
|
| }''');
|
| - assertNoErrors(source);
|
| + await assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithFieldInitializedByNonConst() {
|
| + test_constConstructorWithFieldInitializedByNonConst() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final int i = f();
|
| @@ -810,7 +853,7 @@ int f() {
|
| }''');
|
| // TODO(paulberry): the error CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE is
|
| // redundant and ought to be suppressed.
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode
|
| .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
|
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
|
| @@ -818,7 +861,7 @@ int f() {
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithFieldInitializedByNonConst_static() {
|
| + test_constConstructorWithFieldInitializedByNonConst_static() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static final int i = f();
|
| @@ -827,22 +870,23 @@ class A {
|
| int f() {
|
| return 3;
|
| }''');
|
| - assertNoErrors(source);
|
| + await assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithMixin() {
|
| + test_constConstructorWithMixin() async {
|
| Source source = addSource(r'''
|
| class M {
|
| }
|
| class A extends Object with M {
|
| const A();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithNonConstSuper_explicit() {
|
| + test_constConstructorWithNonConstSuper_explicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A();
|
| @@ -850,12 +894,12 @@ class A {
|
| class B extends A {
|
| const B(): super();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithNonConstSuper_implicit() {
|
| + test_constConstructorWithNonConstSuper_implicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A();
|
| @@ -863,12 +907,12 @@ class A {
|
| class B extends A {
|
| const B();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithNonFinalField_mixin() {
|
| + test_constConstructorWithNonFinalField_mixin() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var a;
|
| @@ -876,14 +920,14 @@ class A {
|
| class B extends Object with A {
|
| const B();
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN,
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithNonFinalField_super() {
|
| + test_constConstructorWithNonFinalField_super() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var a;
|
| @@ -891,26 +935,26 @@ class A {
|
| class B extends A {
|
| const B();
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constConstructorWithNonFinalField_this() {
|
| + test_constConstructorWithNonFinalField_this() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| const A();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constDeferredClass() {
|
| - resolveWithErrors(<String>[
|
| + test_constDeferredClass() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {
|
| @@ -927,8 +971,8 @@ main() {
|
| ]);
|
| }
|
|
|
| - void test_constDeferredClass_namedConstructor() {
|
| - resolveWithErrors(<String>[
|
| + test_constDeferredClass_namedConstructor() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {
|
| @@ -945,18 +989,18 @@ main() {
|
| ]);
|
| }
|
|
|
| - void test_constEval_newInstance_constConstructor() {
|
| + test_constEval_newInstance_constConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| }
|
| const a = new A();''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEval_newInstance_externalFactoryConstConstructor() {
|
| + test_constEval_newInstance_externalFactoryConstConstructor() async {
|
| // We can't evaluate "const A()" because its constructor is external. But
|
| // the code is correct--we shouldn't report an error.
|
| Source source = addSource(r'''
|
| @@ -964,11 +1008,11 @@ class A {
|
| external factory const A();
|
| }
|
| const x = const A();''');
|
| - assertNoErrors(source);
|
| + await assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEval_nonStaticField_inGenericClass() {
|
| + test_constEval_nonStaticField_inGenericClass() async {
|
| Source source = addSource('''
|
| class C<T> {
|
| const C();
|
| @@ -976,12 +1020,12 @@ class C<T> {
|
| }
|
|
|
| const x = const C().t;''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEval_propertyExtraction_targetNotConst() {
|
| + test_constEval_propertyExtraction_targetNotConst() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -989,28 +1033,28 @@ class A {
|
| }
|
| final a = const A();
|
| const C = a.m;''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalThrowsException_binaryMinus_null() {
|
| - _check_constEvalThrowsException_binary_null("null - 5", false);
|
| - _check_constEvalThrowsException_binary_null("5 - null", true);
|
| + test_constEvalThrowsException_binaryMinus_null() async {
|
| + await _check_constEvalThrowsException_binary_null("null - 5", false);
|
| + await _check_constEvalThrowsException_binary_null("5 - null", true);
|
| }
|
|
|
| - void test_constEvalThrowsException_binaryPlus_null() {
|
| - _check_constEvalThrowsException_binary_null("null + 5", false);
|
| - _check_constEvalThrowsException_binary_null("5 + null", true);
|
| + test_constEvalThrowsException_binaryPlus_null() async {
|
| + await _check_constEvalThrowsException_binary_null("null + 5", false);
|
| + await _check_constEvalThrowsException_binary_null("5 + null", true);
|
| }
|
|
|
| - void test_constEvalThrowsException_divisionByZero() {
|
| + test_constEvalThrowsException_divisionByZero() async {
|
| Source source = addSource("const C = 1 ~/ 0;");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalThrowsException_finalAlreadySet_initializer() {
|
| + test_constEvalThrowsException_finalAlreadySet_initializer() async {
|
| // If a final variable has an initializer at the site of its declaration,
|
| // and at the site of the constructor, then invoking that constructor would
|
| // produce a runtime error; hence invoking that constructor via the "const"
|
| @@ -1022,14 +1066,14 @@ class C {
|
| }
|
| var x = const C();
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalThrowsException_finalAlreadySet_initializing_formal() {
|
| + test_constEvalThrowsException_finalAlreadySet_initializing_formal() async {
|
| // If a final variable has an initializer at the site of its declaration,
|
| // and it is initialized using an initializing formal at the site of the
|
| // constructor, then invoking that constructor would produce a runtime
|
| @@ -1042,39 +1086,42 @@ class C {
|
| }
|
| var x = const C(2);
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalThrowsException_unaryBitNot_null() {
|
| + test_constEvalThrowsException_unaryBitNot_null() async {
|
| Source source = addSource("const C = ~null;");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), '~null' is not resolved
|
| }
|
|
|
| - void test_constEvalThrowsException_unaryNegated_null() {
|
| + test_constEvalThrowsException_unaryNegated_null() async {
|
| Source source = addSource("const C = -null;");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), '-null' is not resolved
|
| }
|
|
|
| - void test_constEvalThrowsException_unaryNot_null() {
|
| + test_constEvalThrowsException_unaryNot_null() async {
|
| Source source = addSource("const C = !null;");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalTypeBool_binary() {
|
| - _check_constEvalTypeBool_withParameter_binary("p && ''");
|
| - _check_constEvalTypeBool_withParameter_binary("p || ''");
|
| + test_constEvalTypeBool_binary() async {
|
| + await _check_constEvalTypeBool_withParameter_binary("p && ''");
|
| + await _check_constEvalTypeBool_withParameter_binary("p || ''");
|
| }
|
|
|
| - void test_constEvalTypeBool_binary_leftTrue() {
|
| + test_constEvalTypeBool_binary_leftTrue() async {
|
| Source source = addSource("const C = (true || 0);");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND,
|
| HintCode.DEAD_CODE
|
| @@ -1082,7 +1129,7 @@ var x = const C(2);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalTypeBoolNumString_equal() {
|
| + test_constEvalTypeBoolNumString_equal() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1091,12 +1138,12 @@ class B {
|
| final a;
|
| const B(num p) : a = p == const A();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalTypeBoolNumString_notEqual() {
|
| + test_constEvalTypeBoolNumString_notEqual() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1105,59 +1152,59 @@ class B {
|
| final a;
|
| const B(String p) : a = p != const A();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constEvalTypeInt_binary() {
|
| - _check_constEvalTypeInt_withParameter_binary("p ^ ''");
|
| - _check_constEvalTypeInt_withParameter_binary("p & ''");
|
| - _check_constEvalTypeInt_withParameter_binary("p | ''");
|
| - _check_constEvalTypeInt_withParameter_binary("p >> ''");
|
| - _check_constEvalTypeInt_withParameter_binary("p << ''");
|
| + test_constEvalTypeInt_binary() async {
|
| + await _check_constEvalTypeInt_withParameter_binary("p ^ ''");
|
| + await _check_constEvalTypeInt_withParameter_binary("p & ''");
|
| + await _check_constEvalTypeInt_withParameter_binary("p | ''");
|
| + await _check_constEvalTypeInt_withParameter_binary("p >> ''");
|
| + await _check_constEvalTypeInt_withParameter_binary("p << ''");
|
| }
|
|
|
| - void test_constEvalTypeNum_binary() {
|
| - _check_constEvalTypeNum_withParameter_binary("p + ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p - ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p * ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p / ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p ~/ ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p > ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p < ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p >= ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p <= ''");
|
| - _check_constEvalTypeNum_withParameter_binary("p % ''");
|
| + test_constEvalTypeNum_binary() async {
|
| + await _check_constEvalTypeNum_withParameter_binary("p + ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p - ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p * ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p / ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p ~/ ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p > ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p < ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p >= ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p <= ''");
|
| + await _check_constEvalTypeNum_withParameter_binary("p % ''");
|
| }
|
|
|
| - void test_constFormalParameter_fieldFormalParameter() {
|
| + test_constFormalParameter_fieldFormalParameter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var x;
|
| A(const this.x) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constFormalParameter_simpleFormalParameter() {
|
| + test_constFormalParameter_simpleFormalParameter() async {
|
| Source source = addSource("f(const x) {}");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValue() {
|
| + test_constInitializedWithNonConstValue() async {
|
| Source source = addSource(r'''
|
| f(p) {
|
| const C = p;
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValue_finalField() {
|
| + test_constInitializedWithNonConstValue_finalField() async {
|
| // Regression test for bug #25526 which previously
|
| // caused two errors to be reported.
|
| Source source = addSource(r'''
|
| @@ -1166,26 +1213,27 @@ class Foo {
|
| foo([int x = field]) {}
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValue_missingConstInListLiteral() {
|
| + test_constInitializedWithNonConstValue_missingConstInListLiteral() async {
|
| Source source = addSource("const List L = [0];");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValue_missingConstInMapLiteral() {
|
| + test_constInitializedWithNonConstValue_missingConstInMapLiteral() async {
|
| Source source = addSource("const Map M = {'a' : 0};");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValueFromDeferredClass() {
|
| - resolveWithErrors(<String>[
|
| + test_constInitializedWithNonConstValueFromDeferredClass() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const V = 1;''',
|
| @@ -1199,8 +1247,8 @@ const B = a.V;'''
|
| ]);
|
| }
|
|
|
| - void test_constInitializedWithNonConstValueFromDeferredClass_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_constInitializedWithNonConstValueFromDeferredClass_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const V = 1;''',
|
| @@ -1214,16 +1262,16 @@ const B = a.V + 1;'''
|
| ]);
|
| }
|
|
|
| - void test_constInstanceField() {
|
| + test_constInstanceField() async {
|
| Source source = addSource(r'''
|
| class C {
|
| const int f = 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constMapKeyTypeImplementsEquals_direct() {
|
| + test_constMapKeyTypeImplementsEquals_direct() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1232,12 +1280,12 @@ class A {
|
| main() {
|
| const {const A() : 0};
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constMapKeyTypeImplementsEquals_dynamic() {
|
| + test_constMapKeyTypeImplementsEquals_dynamic() async {
|
| // Note: static type of B.a is "dynamic", but actual type of the const
|
| // object is A. We need to make sure we examine the actual type when
|
| // deciding whether there is a problem with operator==.
|
| @@ -1252,12 +1300,12 @@ class B {
|
| main() {
|
| const {B.a : 0};
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constMapKeyTypeImplementsEquals_factory() {
|
| + test_constMapKeyTypeImplementsEquals_factory() async {
|
| Source source = addSource(r'''
|
| class A { const factory A() = B; }
|
|
|
| @@ -1270,12 +1318,12 @@ class B implements A {
|
| main() {
|
| var m = const { const A(): 42 };
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constMapKeyTypeImplementsEquals_super() {
|
| + test_constMapKeyTypeImplementsEquals_super() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1287,23 +1335,23 @@ class B extends A {
|
| main() {
|
| const {const B() : 0};
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithInvalidTypeParameters() {
|
| + test_constWithInvalidTypeParameters() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| }
|
| f() { return const A<A>(); }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithInvalidTypeParameters_tooFew() {
|
| + test_constWithInvalidTypeParameters_tooFew() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C<K, V> {
|
| @@ -1312,12 +1360,12 @@ class C<K, V> {
|
| f(p) {
|
| return const C<A>();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithInvalidTypeParameters_tooMany() {
|
| + test_constWithInvalidTypeParameters_tooMany() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C<E> {
|
| @@ -1326,22 +1374,22 @@ class C<E> {
|
| f(p) {
|
| return const C<A, A>();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonConst() {
|
| + test_constWithNonConst() async {
|
| Source source = addSource(r'''
|
| class T {
|
| T(a, b, {c, d}) {}
|
| }
|
| f() { return const T(0, 1, c: 2, d: 3); }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonConst_with() {
|
| + test_constWithNonConst_with() async {
|
| Source source = addSource(r'''
|
| class B {
|
| const B();
|
| @@ -1353,11 +1401,11 @@ main() {
|
| print(x);
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonConstantArgument_annotation() {
|
| + test_constWithNonConstantArgument_annotation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A(int p);
|
| @@ -1366,12 +1414,12 @@ var v = 42;
|
| @A(v)
|
| main() {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonConstantArgument_instanceCreation() {
|
| + test_constWithNonConstantArgument_instanceCreation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A(a);
|
| @@ -1379,24 +1427,24 @@ class A {
|
| f(p) { return const A(p); }''');
|
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
|
| // suppressed.
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT,
|
| CompileTimeErrorCode.INVALID_CONSTANT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonType() {
|
| + test_constWithNonType() async {
|
| Source source = addSource(r'''
|
| int A;
|
| f() {
|
| return const A();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithNonType_fromLibrary() {
|
| + test_constWithNonType_fromLibrary() async {
|
| Source source1 = addNamedSource("/lib.dart", "");
|
| Source source2 = addNamedSource(
|
| "/lib2.dart",
|
| @@ -1405,37 +1453,37 @@ import 'lib.dart' as lib;
|
| void f() {
|
| const lib.A();
|
| }''');
|
| - assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| + await assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| verify([source1]);
|
| }
|
|
|
| - void test_constWithTypeParameters_direct() {
|
| + test_constWithTypeParameters_direct() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| static const V = const A<T>();
|
| const A();
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
|
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithTypeParameters_indirect() {
|
| + test_constWithTypeParameters_indirect() async {
|
| Source source = addSource(r'''
|
| class A<T> {
|
| static const V = const A<List<T>>();
|
| const A();
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
|
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_constWithUndefinedConstructor() {
|
| + test_constWithUndefinedConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1443,12 +1491,12 @@ class A {
|
| f() {
|
| return const A.noSuchConstructor();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]);
|
| // no verify(), 'noSuchConstructor' is not resolved
|
| }
|
|
|
| - void test_constWithUndefinedConstructorDefault() {
|
| + test_constWithUndefinedConstructorDefault() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A.name();
|
| @@ -1456,33 +1504,33 @@ class A {
|
| f() {
|
| return const A();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_defaultValueInFunctionTypeAlias() {
|
| + test_defaultValueInFunctionTypeAlias() async {
|
| Source source = addSource("typedef F([x = 0]);");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_defaultValueInFunctionTypedParameter_named() {
|
| + test_defaultValueInFunctionTypedParameter_named() async {
|
| Source source = addSource("f(g({p: null})) {}");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_defaultValueInFunctionTypedParameter_optional() {
|
| + test_defaultValueInFunctionTypedParameter_optional() async {
|
| Source source = addSource("f(g([p = null])) {}");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_defaultValueInRedirectingFactoryConstructor() {
|
| + test_defaultValueInRedirectingFactoryConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A([int x = 0]) = B;
|
| @@ -1491,39 +1539,39 @@ class A {
|
| class B implements A {
|
| B([int x = 1]) {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateConstructorName_named() {
|
| + test_duplicateConstructorName_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.a() {}
|
| A.a() {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateConstructorName_unnamed() {
|
| + test_duplicateConstructorName_unnamed() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() {}
|
| A() {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_acrossLibraries() {
|
| + test_duplicateDefinition_acrossLibraries() async {
|
| Source librarySource = addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -1543,51 +1591,51 @@ class A {}''');
|
| part of lib;
|
|
|
| class A {}''');
|
| - assertNoErrors(librarySource);
|
| - assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertNoErrors(librarySource);
|
| + await assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([librarySource, sourceA, sourceB]);
|
| }
|
|
|
| - void test_duplicateDefinition_catch() {
|
| + test_duplicateDefinition_catch() async {
|
| Source source = addSource(r'''
|
| main() {
|
| try {} catch (e, e) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_classMembers_fields() {
|
| + test_duplicateDefinition_classMembers_fields() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int a;
|
| int a;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_classMembers_fields_oneStatic() {
|
| + test_duplicateDefinition_classMembers_fields_oneStatic() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| static int x;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_classMembers_methods() {
|
| + test_duplicateDefinition_classMembers_methods() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| m() {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_inPart() {
|
| + test_duplicateDefinition_inPart() async {
|
| Source librarySource = addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -1599,12 +1647,12 @@ class A {}''');
|
| r'''
|
| part of test;
|
| class A {}''');
|
| - assertNoErrors(librarySource);
|
| - assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertNoErrors(librarySource);
|
| + await assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([librarySource, sourceA]);
|
| }
|
|
|
| - void test_duplicateDefinition_locals_inCase() {
|
| + test_duplicateDefinition_locals_inCase() async {
|
| Source source = addSource(r'''
|
| main() {
|
| switch(1) {
|
| @@ -1613,21 +1661,21 @@ main() {
|
| var a;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_locals_inFunctionBlock() {
|
| + test_duplicateDefinition_locals_inFunctionBlock() async {
|
| Source source = addSource(r'''
|
| main() {
|
| int m = 0;
|
| m(a) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_locals_inIf() {
|
| + test_duplicateDefinition_locals_inIf() async {
|
| Source source = addSource(r'''
|
| main(int p) {
|
| if (p != 0) {
|
| @@ -1635,11 +1683,11 @@ main(int p) {
|
| var a;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_locals_inMethodBlock() {
|
| + test_duplicateDefinition_locals_inMethodBlock() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {
|
| @@ -1647,65 +1695,65 @@ class A {
|
| int a;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_parameters_inConstructor() {
|
| + test_duplicateDefinition_parameters_inConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int a;
|
| A(int a, this.a);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_parameters_inFunctionTypeAlias() {
|
| + test_duplicateDefinition_parameters_inFunctionTypeAlias() async {
|
| Source source = addSource(r'''
|
| typedef F(int a, double a);
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_parameters_inLocalFunction() {
|
| + test_duplicateDefinition_parameters_inLocalFunction() async {
|
| Source source = addSource(r'''
|
| main() {
|
| f(int a, double a) {
|
| };
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_parameters_inMethod() {
|
| + test_duplicateDefinition_parameters_inMethod() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m(int a, double a) {
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_parameters_inTopLevelFunction() {
|
| + test_duplicateDefinition_parameters_inTopLevelFunction() async {
|
| Source source = addSource(r'''
|
| f(int a, double a) {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinition_typeParameters() {
|
| + test_duplicateDefinition_typeParameters() async {
|
| Source source = addSource(r'''
|
| class A<T, T> {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() {
|
| + test_duplicateDefinitionInheritance_instanceGetter_staticGetter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int get x => 0;
|
| @@ -1713,13 +1761,12 @@ class A {
|
| class B extends A {
|
| static int get x => 0;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void
|
| - test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() {
|
| + test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() async {
|
| Source source = addSource(r'''
|
| abstract class A {
|
| int get x;
|
| @@ -1727,12 +1774,12 @@ abstract class A {
|
| class B extends A {
|
| static int get x => 0;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() {
|
| + test_duplicateDefinitionInheritance_instanceMethod_staticMethod() async {
|
| Source source = addSource(r'''
|
| class A {
|
| x() {}
|
| @@ -1740,13 +1787,12 @@ class A {
|
| class B extends A {
|
| static x() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void
|
| - test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() {
|
| + test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() async {
|
| Source source = addSource(r'''
|
| abstract class A {
|
| x();
|
| @@ -1754,12 +1800,12 @@ abstract class A {
|
| abstract class B extends A {
|
| static x() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateDefinitionInheritance_instanceSetter_staticSetter() {
|
| + test_duplicateDefinitionInheritance_instanceSetter_staticSetter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x(value) {}
|
| @@ -1767,13 +1813,12 @@ class A {
|
| class B extends A {
|
| static set x(value) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void
|
| - test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() {
|
| + test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() async {
|
| Source source = addSource(r'''
|
| abstract class A {
|
| set x(value);
|
| @@ -1781,60 +1826,61 @@ abstract class A {
|
| class B extends A {
|
| static set x(value) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicateNamedArgument() {
|
| + test_duplicateNamedArgument() async {
|
| Source source = addSource(r'''
|
| f({a, b}) {}
|
| main() {
|
| f(a: 1, a: 2);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicatePart_sameSource() {
|
| + test_duplicatePart_sameSource() async {
|
| addNamedSource('/part.dart', 'part of lib;');
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'part.dart';
|
| part 'foo/../part.dart';
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| verify([source]);
|
| }
|
|
|
| - void test_duplicatePart_sameUri() {
|
| + test_duplicatePart_sameUri() async {
|
| addNamedSource('/part.dart', 'part of lib;');
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'part.dart';
|
| part 'part.dart';
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| + await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| verify([source]);
|
| }
|
|
|
| - void test_exportInternalLibrary() {
|
| + test_exportInternalLibrary() async {
|
| Source source = addSource("export 'dart:_interceptors';");
|
| - assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
|
| + await assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_exportOfNonLibrary() {
|
| + test_exportOfNonLibrary() async {
|
| Source source = addSource(r'''
|
| library L;
|
| export 'lib1.dart';''');
|
| addNamedSource("/lib1.dart", "part of lib;");
|
| - assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
|
| + await assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDeferredClass() {
|
| - resolveWithErrors(<String>[
|
| + test_extendsDeferredClass() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -1847,8 +1893,8 @@ class B extends a.A {}'''
|
| ]);
|
| }
|
|
|
| - void test_extendsDeferredClass_classTypeAlias() {
|
| - resolveWithErrors(<String>[
|
| + test_extendsDeferredClass_classTypeAlias() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -1862,125 +1908,133 @@ class C = a.A with M;'''
|
| ]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_bool() {
|
| + test_extendsDisallowedClass_class_bool() async {
|
| Source source = addSource("class A extends bool {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_double() {
|
| + test_extendsDisallowedClass_class_double() async {
|
| Source source = addSource("class A extends double {}");
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_int() {
|
| + test_extendsDisallowedClass_class_int() async {
|
| Source source = addSource("class A extends int {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_Null() {
|
| + test_extendsDisallowedClass_class_Null() async {
|
| Source source = addSource("class A extends Null {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_num() {
|
| + test_extendsDisallowedClass_class_num() async {
|
| Source source = addSource("class A extends num {}");
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_class_String() {
|
| + test_extendsDisallowedClass_class_String() async {
|
| Source source = addSource("class A extends String {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_bool() {
|
| + test_extendsDisallowedClass_classTypeAlias_bool() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = bool with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_double() {
|
| + test_extendsDisallowedClass_classTypeAlias_double() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = double with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_int() {
|
| + test_extendsDisallowedClass_classTypeAlias_int() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = int with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_Null() {
|
| + test_extendsDisallowedClass_classTypeAlias_Null() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = Null with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_num() {
|
| + test_extendsDisallowedClass_classTypeAlias_num() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = num with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsDisallowedClass_classTypeAlias_String() {
|
| + test_extendsDisallowedClass_classTypeAlias_String() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = String with M;''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsEnum() {
|
| + test_extendsEnum() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A extends E {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
|
| + await assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsNonClass_class() {
|
| + test_extendsNonClass_class() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B extends A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extendsNonClass_dynamic() {
|
| + test_extendsNonClass_dynamic() async {
|
| Source source = addSource("class B extends dynamic {}");
|
| - assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extraPositionalArguments_const() {
|
| + test_extraPositionalArguments_const() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -1988,11 +2042,12 @@ class A {
|
| main() {
|
| const A(0);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_extraPositionalArguments_const_super() {
|
| + test_extraPositionalArguments_const_super() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -2000,160 +2055,161 @@ class A {
|
| class B extends A {
|
| const B() : super(0);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldFormalParameter_assignedInInitializer() {
|
| + test_fieldFormalParameter_assignedInInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A(this.x) : x = 3 {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializedByMultipleInitializers() {
|
| + test_fieldInitializedByMultipleInitializers() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A() : x = 0, x = 1 {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializedByMultipleInitializers_multipleInits() {
|
| + test_fieldInitializedByMultipleInitializers_multipleInits() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A() : x = 0, x = 1, x = 2 {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializedByMultipleInitializers_multipleNames() {
|
| + test_fieldInitializedByMultipleInitializers_multipleNames() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| int y;
|
| A() : x = 0, x = 1, y = 0, y = 1 {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializedInParameterAndInitializer() {
|
| + test_fieldInitializedInParameterAndInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A(this.x) : x = 1 {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerFactoryConstructor() {
|
| + test_fieldInitializerFactoryConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| factory A(this.x) => null;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerOutsideConstructor() {
|
| + test_fieldInitializerOutsideConstructor() async {
|
| // TODO(brianwilkerson) Fix the duplicate error messages.
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| m(this.x) {}
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
|
| CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerOutsideConstructor_defaultParameter() {
|
| + test_fieldInitializerOutsideConstructor_defaultParameter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| m([this.x]) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerOutsideConstructor_inFunctionTypeParameter() {
|
| + test_fieldInitializerOutsideConstructor_inFunctionTypeParameter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A(int p(this.x));
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerRedirectingConstructor_afterRedirection() {
|
| + test_fieldInitializerRedirectingConstructor_afterRedirection() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A.named() {}
|
| A() : this.named(), x = 42;
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializerRedirectingConstructor_beforeRedirection() {
|
| + test_fieldInitializerRedirectingConstructor_beforeRedirection() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A.named() {}
|
| A() : x = 42, this.named();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fieldInitializingFormalRedirectingConstructor() {
|
| + test_fieldInitializingFormalRedirectingConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| A.named() {}
|
| A(this.x) : this.named();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_finalInitializedMultipleTimes_initializers() {
|
| + test_finalInitializedMultipleTimes_initializers() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final x;
|
| A() : x = 0, x = 0 {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
|
| verify([source]);
|
| }
|
| @@ -2166,60 +2222,60 @@ class A {
|
| * Note: FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER covers a subset of
|
| * FINAL_INITIALIZED_MULTIPLE_TIMES, since it more specific, we use it instead of the broader code
|
| */
|
| - void test_finalInitializedMultipleTimes_initializingFormal_initializer() {
|
| + test_finalInitializedMultipleTimes_initializingFormal_initializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final x;
|
| A(this.x) : x = 0 {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_finalInitializedMultipleTimes_initializingFormals() {
|
| + test_finalInitializedMultipleTimes_initializingFormals() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final x;
|
| A(this.x, this.x) {}
|
| }''');
|
| // TODO(brianwilkerson) There should only be one error here.
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_DEFINITION,
|
| CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_finalNotInitialized_instanceField_const_static() {
|
| + test_finalNotInitialized_instanceField_const_static() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static const F;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| - void test_finalNotInitialized_library_const() {
|
| + test_finalNotInitialized_library_const() async {
|
| Source source = addSource("const F;");
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| - void test_finalNotInitialized_local_const() {
|
| + test_finalNotInitialized_local_const() async {
|
| Source source = addSource(r'''
|
| f() {
|
| const int x;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| - void test_fromEnvironment_bool_badArgs() {
|
| + test_fromEnvironment_bool_badArgs() async {
|
| Source source = addSource(r'''
|
| var b1 = const bool.fromEnvironment(1);
|
| var b2 = const bool.fromEnvironment('x', defaultValue: 1);''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| @@ -2228,32 +2284,32 @@ var b2 = const bool.fromEnvironment('x', defaultValue: 1);''');
|
| verify([source]);
|
| }
|
|
|
| - void test_fromEnvironment_bool_badDefault_whenDefined() {
|
| + test_fromEnvironment_bool_badDefault_whenDefined() async {
|
| // The type of the defaultValue needs to be correct even when the default
|
| // value isn't used (because the variable is defined in the environment).
|
| analysisContext2.declaredVariables.define("x", "true");
|
| Source source =
|
| addSource("var b = const bool.fromEnvironment('x', defaultValue: 1);");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_getterAndMethodWithSameName() {
|
| + test_getterAndMethodWithSameName() async {
|
| Source source = addSource(r'''
|
| class A {
|
| x(y) {}
|
| get x => 0;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDeferredClass() {
|
| - resolveWithErrors(<String>[
|
| + test_implementsDeferredClass() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -2266,8 +2322,8 @@ class B implements a.A {}'''
|
| ]);
|
| }
|
|
|
| - void test_implementsDeferredClass_classTypeAlias() {
|
| - resolveWithErrors(<String>[
|
| + test_implementsDeferredClass_classTypeAlias() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -2282,162 +2338,174 @@ class C = B with M implements a.A;'''
|
| ]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_bool() {
|
| + test_implementsDisallowedClass_class_bool() async {
|
| Source source = addSource("class A implements bool {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_double() {
|
| + test_implementsDisallowedClass_class_double() async {
|
| Source source = addSource("class A implements double {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_int() {
|
| + test_implementsDisallowedClass_class_int() async {
|
| Source source = addSource("class A implements int {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_Null() {
|
| + test_implementsDisallowedClass_class_Null() async {
|
| Source source = addSource("class A implements Null {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_num() {
|
| + test_implementsDisallowedClass_class_num() async {
|
| Source source = addSource("class A implements num {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_String() {
|
| + test_implementsDisallowedClass_class_String() async {
|
| Source source = addSource("class A implements String {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_class_String_num() {
|
| + test_implementsDisallowedClass_class_String_num() async {
|
| Source source = addSource("class A implements String, num {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_bool() {
|
| + test_implementsDisallowedClass_classTypeAlias_bool() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements bool;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_double() {
|
| + test_implementsDisallowedClass_classTypeAlias_double() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements double;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_int() {
|
| + test_implementsDisallowedClass_classTypeAlias_int() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements int;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_Null() {
|
| + test_implementsDisallowedClass_classTypeAlias_Null() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements Null;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_num() {
|
| + test_implementsDisallowedClass_classTypeAlias_num() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements num;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_String() {
|
| + test_implementsDisallowedClass_classTypeAlias_String() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements String;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDisallowedClass_classTypeAlias_String_num() {
|
| + test_implementsDisallowedClass_classTypeAlias_String_num() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements String, num;''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsDynamic() {
|
| + test_implementsDynamic() async {
|
| Source source = addSource("class A implements dynamic {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsEnum() {
|
| + test_implementsEnum() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A implements E {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsNonClass_class() {
|
| + test_implementsNonClass_class() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B implements A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsNonClass_typeAlias() {
|
| + test_implementsNonClass_typeAlias() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| int B;
|
| class C = A with M implements B;''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsRepeated() {
|
| + test_implementsRepeated() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B implements A, A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsRepeated_3times() {
|
| + test_implementsRepeated_3times() async {
|
| Source source = addSource(r'''
|
| class A {} class C{}
|
| class B implements A, A, A, A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED,
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED,
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED
|
| @@ -2445,80 +2513,79 @@ class B implements A, A, A, A {}''');
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsSuperClass() {
|
| + test_implementsSuperClass() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A implements A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implementsSuperClass_Object() {
|
| + test_implementsSuperClass_Object() async {
|
| Source source = addSource("class A implements Object {}");
|
| - assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implicitThisReferenceInInitializer_field() {
|
| + test_implicitThisReferenceInInitializer_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var v;
|
| A() : v = f;
|
| var f;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implicitThisReferenceInInitializer_field2() {
|
| + test_implicitThisReferenceInInitializer_field2() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final x = 0;
|
| final y = x;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implicitThisReferenceInInitializer_invocation() {
|
| + test_implicitThisReferenceInInitializer_invocation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var v;
|
| A() : v = f();
|
| f() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implicitThisReferenceInInitializer_invocationInStatic() {
|
| + test_implicitThisReferenceInInitializer_invocationInStatic() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static var F = m();
|
| m() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void
|
| - test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() {
|
| + test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(p) {}
|
| A.named() : this(f);
|
| var f;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_implicitThisReferenceInInitializer_superConstructorInvocation() {
|
| + test_implicitThisReferenceInInitializer_superConstructorInvocation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(p) {}
|
| @@ -2527,36 +2594,36 @@ class B extends A {
|
| B() : super(f);
|
| var f;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_importInternalLibrary() {
|
| + test_importInternalLibrary() async {
|
| Source source = addSource("import 'dart:_interceptors';");
|
| // Note, in these error cases we may generate an UNUSED_IMPORT hint, while
|
| // we could prevent the hint from being generated by testing the import
|
| // directive for the error, this is such a minor corner case that we don't
|
| // think we should add the additional computation time to figure out such
|
| // cases.
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_importInternalLibrary_js_helper() {
|
| + test_importInternalLibrary_js_helper() async {
|
| Source source = addSource("import 'dart:_js_helper';");
|
| // Note, in these error cases we may generate an UNUSED_IMPORT hint, while
|
| // we could prevent the hint from being generated by testing the import
|
| // directive for the error, this is such a minor corner case that we don't
|
| // think we should add the additional computation time to figure out such
|
| // cases.
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_importOfNonLibrary() {
|
| + test_importOfNonLibrary() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| import 'part.dart';
|
| @@ -2566,11 +2633,11 @@ A a;''');
|
| r'''
|
| part of lib;
|
| class A{}''');
|
| - assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
|
| + await assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_inconsistentCaseExpressionTypes() {
|
| + test_inconsistentCaseExpressionTypes() async {
|
| Source source = addSource(r'''
|
| f(var p) {
|
| switch (p) {
|
| @@ -2580,12 +2647,12 @@ f(var p) {
|
| break;
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]);
|
| verify([source]);
|
| }
|
|
|
| - void test_inconsistentCaseExpressionTypes_dynamic() {
|
| + test_inconsistentCaseExpressionTypes_dynamic() async {
|
| // Even though A.S and S have a static type of "dynamic", we should see
|
| // that they fail to match 3, because they are constant strings.
|
| Source source = addSource(r'''
|
| @@ -2605,14 +2672,14 @@ foo(var p) {
|
| break;
|
| }
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_inconsistentCaseExpressionTypes_repeated() {
|
| + test_inconsistentCaseExpressionTypes_repeated() async {
|
| Source source = addSource(r'''
|
| f(var p) {
|
| switch (p) {
|
| @@ -2624,14 +2691,14 @@ f(var p) {
|
| break;
|
| }
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializerForNonExistent_const() {
|
| + test_initializerForNonExistent_const() async {
|
| // Check that the absence of a matching field doesn't cause a
|
| // crash during constant evaluation.
|
| Source source = addSource(r'''
|
| @@ -2639,40 +2706,41 @@ class A {
|
| const A() : x = 'foo';
|
| }
|
| A a = const A();''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
|
| }
|
|
|
| - void test_initializerForNonExistent_initializer() {
|
| + test_initializerForNonExistent_initializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() : x = 0 {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
|
| }
|
|
|
| - void test_initializerForStaticField() {
|
| + test_initializerForStaticField() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static int x;
|
| A() : x = 0 {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializingFormalForNonExistentField() {
|
| + test_initializingFormalForNonExistentField() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(this.x) {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializingFormalForNonExistentField_notInEnclosingClass() {
|
| + test_initializingFormalForNonExistentField_notInEnclosingClass() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int x;
|
| @@ -2680,44 +2748,44 @@ int x;
|
| class B extends A {
|
| B(this.x) {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializingFormalForNonExistentField_optional() {
|
| + test_initializingFormalForNonExistentField_optional() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A([this.x]) {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializingFormalForNonExistentField_synthetic() {
|
| + test_initializingFormalForNonExistentField_synthetic() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int get x => 1;
|
| A(this.x) {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_initializingFormalForStaticField() {
|
| + test_initializingFormalForStaticField() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static int x;
|
| A([this.x]) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instanceMemberAccessFromFactory_named() {
|
| + test_instanceMemberAccessFromFactory_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -2727,12 +2795,12 @@ class A {
|
| return new A();
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instanceMemberAccessFromFactory_unnamed() {
|
| + test_instanceMemberAccessFromFactory_unnamed() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -2742,12 +2810,12 @@ class A {
|
| return new A._();
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instanceMemberAccessFromStatic_field() {
|
| + test_instanceMemberAccessFromStatic_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int f;
|
| @@ -2755,12 +2823,12 @@ class A {
|
| f;
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instanceMemberAccessFromStatic_getter() {
|
| + test_instanceMemberAccessFromStatic_getter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| get g => null;
|
| @@ -2768,12 +2836,12 @@ class A {
|
| g;
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instanceMemberAccessFromStatic_method() {
|
| + test_instanceMemberAccessFromStatic_method() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -2781,42 +2849,42 @@ class A {
|
| m();
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instantiateEnum_const() {
|
| + test_instantiateEnum_const() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| E e(String name) {
|
| return const E();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| - void test_instantiateEnum_new() {
|
| + test_instantiateEnum_new() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| E e(String name) {
|
| return new E();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_getter() {
|
| + test_invalidAnnotation_getter() async {
|
| Source source = addSource(r'''
|
| get V => 0;
|
| @V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_importWithPrefix_getter() {
|
| + test_invalidAnnotation_importWithPrefix_getter() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -2827,11 +2895,11 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_importWithPrefix_notConstantVariable() {
|
| + test_invalidAnnotation_importWithPrefix_notConstantVariable() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -2842,12 +2910,11 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void
|
| - test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation() {
|
| + test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -2858,31 +2925,31 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_notConstantVariable() {
|
| + test_invalidAnnotation_notConstantVariable() async {
|
| Source source = addSource(r'''
|
| final V = 0;
|
| @V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_notVariableOrConstructorInvocation() {
|
| + test_invalidAnnotation_notVariableOrConstructorInvocation() async {
|
| Source source = addSource(r'''
|
| typedef V();
|
| @V
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_staticMethodReference() {
|
| + test_invalidAnnotation_staticMethodReference() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static f() {}
|
| @@ -2890,47 +2957,47 @@ class A {
|
| @A.f
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidAnnotation_unresolved_identifier() {
|
| + test_invalidAnnotation_unresolved_identifier() async {
|
| Source source = addSource(r'''
|
| @unresolved
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| - void test_invalidAnnotation_unresolved_invocation() {
|
| + test_invalidAnnotation_unresolved_invocation() async {
|
| Source source = addSource(r'''
|
| @Unresolved()
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| - void test_invalidAnnotation_unresolved_prefixedIdentifier() {
|
| + test_invalidAnnotation_unresolved_prefixedIdentifier() async {
|
| Source source = addSource(r'''
|
| import 'dart:math' as p;
|
| @p.unresolved
|
| main() {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| - void test_invalidAnnotation_useLibraryScope() {
|
| + test_invalidAnnotation_useLibraryScope() async {
|
| Source source = addSource(r'''
|
| @foo
|
| class A {
|
| static const foo = null;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| - void test_invalidAnnotationFromDeferredLibrary() {
|
| + test_invalidAnnotationFromDeferredLibrary() async {
|
| // See test_invalidAnnotation_notConstantVariable
|
| - resolveWithErrors(<String>[
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class V { const V(); }
|
| @@ -2944,9 +3011,9 @@ import 'lib1.dart' deferred as a;
|
| ]);
|
| }
|
|
|
| - void test_invalidAnnotationFromDeferredLibrary_constructor() {
|
| + test_invalidAnnotationFromDeferredLibrary_constructor() async {
|
| // See test_invalidAnnotation_notConstantVariable
|
| - resolveWithErrors(<String>[
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class C { const C(); }''',
|
| @@ -2959,9 +3026,9 @@ import 'lib1.dart' deferred as a;
|
| ]);
|
| }
|
|
|
| - void test_invalidAnnotationFromDeferredLibrary_namedConstructor() {
|
| + test_invalidAnnotationFromDeferredLibrary_namedConstructor() async {
|
| // See test_invalidAnnotation_notConstantVariable
|
| - resolveWithErrors(<String>[
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class C { const C.name(); }''',
|
| @@ -2974,168 +3041,181 @@ import 'lib1.dart' deferred as a;
|
| ]);
|
| }
|
|
|
| - void test_invalidConstructorName_notEnclosingClassName_defined() {
|
| + test_invalidConstructorName_notEnclosingClassName_defined() async {
|
| Source source = addSource(r'''
|
| class A {
|
| B() : super();
|
| }
|
| class B {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| // no verify() call, "B" is not resolved
|
| }
|
|
|
| - void test_invalidConstructorName_notEnclosingClassName_undefined() {
|
| + test_invalidConstructorName_notEnclosingClassName_undefined() async {
|
| Source source = addSource(r'''
|
| class A {
|
| B() : super();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| // no verify() call, "B" is not resolved
|
| }
|
|
|
| - void test_invalidFactoryNameNotAClass_notClassName() {
|
| + test_invalidFactoryNameNotAClass_notClassName() async {
|
| Source source = addSource(r'''
|
| int B;
|
| class A {
|
| factory B() => null;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidFactoryNameNotAClass_notEnclosingClassName() {
|
| + test_invalidFactoryNameNotAClass_notEnclosingClassName() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory B() => null;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
|
| // no verify() call, "B" is not resolved
|
| }
|
|
|
| - void test_invalidModifierOnConstructor_async() {
|
| + test_invalidModifierOnConstructor_async() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() async {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnConstructor_asyncStar() {
|
| + test_invalidModifierOnConstructor_asyncStar() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() async* {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnConstructor_syncStar() {
|
| + test_invalidModifierOnConstructor_syncStar() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() sync* {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_member_async() {
|
| + test_invalidModifierOnSetter_member_async() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x(v) async {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_member_asyncStar() {
|
| + test_invalidModifierOnSetter_member_asyncStar() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x(v) async* {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_member_syncStar() {
|
| + test_invalidModifierOnSetter_member_syncStar() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x(v) sync* {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_topLevel_async() {
|
| + test_invalidModifierOnSetter_topLevel_async() async {
|
| Source source = addSource("set x(v) async {}");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_topLevel_asyncStar() {
|
| + test_invalidModifierOnSetter_topLevel_asyncStar() async {
|
| Source source = addSource("set x(v) async* {}");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidModifierOnSetter_topLevel_syncStar() {
|
| + test_invalidModifierOnSetter_topLevel_syncStar() async {
|
| Source source = addSource("set x(v) sync* {}");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_factoryConstructor() {
|
| + test_invalidReferenceToThis_factoryConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A() { return this; }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_instanceVariableInitializer_inConstructor() {
|
| + test_invalidReferenceToThis_instanceVariableInitializer_inConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var f;
|
| A() : f = this;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration() {
|
| + test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var f = this;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_staticMethod() {
|
| + test_invalidReferenceToThis_staticMethod() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static m() { return this; }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_staticVariableInitializer() {
|
| + test_invalidReferenceToThis_staticVariableInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static A f = this;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_superInitializer() {
|
| + test_invalidReferenceToThis_superInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(var x) {}
|
| @@ -3143,64 +3223,67 @@ class A {
|
| class B extends A {
|
| B() : super(this);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_topLevelFunction() {
|
| + test_invalidReferenceToThis_topLevelFunction() async {
|
| Source source = addSource("f() { return this; }");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidReferenceToThis_variableInitializer() {
|
| + test_invalidReferenceToThis_variableInitializer() async {
|
| Source source = addSource("int x = this;");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidTypeArgumentInConstList() {
|
| + test_invalidTypeArgumentInConstList() async {
|
| Source source = addSource(r'''
|
| class A<E> {
|
| m() {
|
| return const <E>[];
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidTypeArgumentInConstMap() {
|
| + test_invalidTypeArgumentInConstMap() async {
|
| Source source = addSource(r'''
|
| class A<E> {
|
| m() {
|
| return const <String, E>{};
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]);
|
| verify([source]);
|
| }
|
|
|
| - void test_invalidUri_export() {
|
| + test_invalidUri_export() async {
|
| Source source = addSource("export 'ht:';");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| - void test_invalidUri_import() {
|
| + test_invalidUri_import() async {
|
| Source source = addSource("import 'ht:';");
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| - void test_invalidUri_part() {
|
| + test_invalidUri_part() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'ht:';''');
|
| - assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| - void test_isInConstInstanceCreation_restored() {
|
| + test_isInConstInstanceCreation_restored() async {
|
| // If ErrorVerifier._isInConstInstanceCreation is not properly restored on
|
| // exit from visitInstanceCreationExpression, the error at (1) will be
|
| // treated as a warning rather than an error.
|
| @@ -3211,12 +3294,12 @@ class Foo<T extends num> {
|
| const x = const Foo<int>(const Foo<int>(0, 1),
|
| const <Foo<String>>[]); // (1)
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_isInInstanceVariableInitializer_restored() {
|
| + test_isInInstanceVariableInitializer_restored() async {
|
| // If ErrorVerifier._isInInstanceVariableInitializer is not properly
|
| // restored on exit from visitVariableDeclaration, the error at (1)
|
| // won't be detected.
|
| @@ -3232,12 +3315,12 @@ class Foo {
|
| _foo() {
|
| }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_labelInOuterScope() {
|
| + test_labelInOuterScope() async {
|
| Source source = addSource(r'''
|
| class A {
|
| void m(int i) {
|
| @@ -3248,37 +3331,37 @@ class A {
|
| }
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]);
|
| + await assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]);
|
| // We cannot verify resolution with unresolvable labels
|
| }
|
|
|
| - void test_labelUndefined_break() {
|
| + test_labelUndefined_break() async {
|
| Source source = addSource(r'''
|
| f() {
|
| x: while (true) {
|
| break y;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| // We cannot verify resolution with undefined labels
|
| }
|
|
|
| - void test_labelUndefined_continue() {
|
| + test_labelUndefined_continue() async {
|
| Source source = addSource(r'''
|
| f() {
|
| x: while (true) {
|
| continue y;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| + await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| // We cannot verify resolution with undefined labels
|
| }
|
|
|
| - void test_length_of_erroneous_constant() {
|
| + test_length_of_erroneous_constant() async {
|
| // Attempting to compute the length of constant that couldn't be evaluated
|
| // (due to an error) should not crash the analyzer (see dartbug.com/23383)
|
| Source source = addSource("const int i = (1 ? 'alpha' : 'beta').length;");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE,
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_CONDITION
|
| @@ -3286,70 +3369,72 @@ f() {
|
| verify([source]);
|
| }
|
|
|
| - void test_memberWithClassName_field() {
|
| + test_memberWithClassName_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int A = 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_memberWithClassName_field2() {
|
| + test_memberWithClassName_field2() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int z, A, b = 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_memberWithClassName_getter() {
|
| + test_memberWithClassName_getter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| get A => 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_memberWithClassName_method() {
|
| + test_memberWithClassName_method() async {
|
| // no test because indistinguishable from constructor
|
| }
|
|
|
| - void test_methodAndGetterWithSameName() {
|
| + test_methodAndGetterWithSameName() async {
|
| Source source = addSource(r'''
|
| class A {
|
| get x => 0;
|
| x(y) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinDeclaresConstructor_classDeclaration() {
|
| + test_mixinDeclaresConstructor_classDeclaration() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() {}
|
| }
|
| class B extends Object with A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinDeclaresConstructor_typeAlias() {
|
| + test_mixinDeclaresConstructor_typeAlias() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() {}
|
| }
|
| class B = Object with A;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinDeferredClass() {
|
| - resolveWithErrors(<String>[
|
| + test_mixinDeferredClass() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -3362,8 +3447,8 @@ class B extends Object with a.A {}'''
|
| ]);
|
| }
|
|
|
| - void test_mixinDeferredClass_classTypeAlias() {
|
| - resolveWithErrors(<String>[
|
| + test_mixinDeferredClass_classTypeAlias() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| class A {}''',
|
| @@ -3377,7 +3462,7 @@ class C = B with a.A;'''
|
| ]);
|
| }
|
|
|
| - void test_mixinHasNoConstructors_mixinApp() {
|
| + test_mixinHasNoConstructors_mixinApp() async {
|
| Source source = addSource(r'''
|
| class B {
|
| B({x});
|
| @@ -3385,11 +3470,12 @@ class B {
|
| class M {}
|
| class C = B with M;
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinHasNoConstructors_mixinClass() {
|
| + test_mixinHasNoConstructors_mixinClass() async {
|
| Source source = addSource(r'''
|
| class B {
|
| B({x});
|
| @@ -3401,11 +3487,12 @@ class C extends B with M {}
|
| // generate a further error (despite the fact that it's not forwarded),
|
| // since CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job
|
| // of explaining the probem to the user.
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinHasNoConstructors_mixinClass_explicitSuperCall() {
|
| + test_mixinHasNoConstructors_mixinClass_explicitSuperCall() async {
|
| Source source = addSource(r'''
|
| class B {
|
| B({x});
|
| @@ -3419,11 +3506,12 @@ class C extends B with M {
|
| // error (despite the fact that it's not forwarded), since
|
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
|
| // explaining the error to the user.
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinHasNoConstructors_mixinClass_implicitSuperCall() {
|
| + test_mixinHasNoConstructors_mixinClass_implicitSuperCall() async {
|
| Source source = addSource(r'''
|
| class B {
|
| B({x});
|
| @@ -3437,11 +3525,12 @@ class C extends B with M {
|
| // error (despite the fact that it's not forwarded), since
|
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
|
| // explaining the error to the user.
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinHasNoConstructors_mixinClass_namedSuperCall() {
|
| + test_mixinHasNoConstructors_mixinClass_namedSuperCall() async {
|
| Source source = addSource(r'''
|
| class B {
|
| B.named({x});
|
| @@ -3455,238 +3544,257 @@ class C extends B with M {
|
| // further error (despite the fact that it's not forwarded), since
|
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
|
| // explaining the error to the user.
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinInheritsFromNotObject_classDeclaration_extends() {
|
| + test_mixinInheritsFromNotObject_classDeclaration_extends() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A {}
|
| class C extends Object with B {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinInheritsFromNotObject_classDeclaration_with() {
|
| + test_mixinInheritsFromNotObject_classDeclaration_with() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends Object with A {}
|
| class C extends Object with B {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinInheritsFromNotObject_typeAlias_extends() {
|
| + test_mixinInheritsFromNotObject_typeAlias_extends() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A {}
|
| class C = Object with B;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinInheritsFromNotObject_typeAlias_with() {
|
| + test_mixinInheritsFromNotObject_typeAlias_with() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends Object with A {}
|
| class C = Object with B;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_bool() {
|
| + test_mixinOfDisallowedClass_class_bool() async {
|
| Source source = addSource("class A extends Object with bool {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_double() {
|
| + test_mixinOfDisallowedClass_class_double() async {
|
| Source source = addSource("class A extends Object with double {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_int() {
|
| + test_mixinOfDisallowedClass_class_int() async {
|
| Source source = addSource("class A extends Object with int {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_Null() {
|
| + test_mixinOfDisallowedClass_class_Null() async {
|
| Source source = addSource("class A extends Object with Null {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_num() {
|
| + test_mixinOfDisallowedClass_class_num() async {
|
| Source source = addSource("class A extends Object with num {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_class_String() {
|
| + test_mixinOfDisallowedClass_class_String() async {
|
| Source source = addSource("class A extends Object with String {}");
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_bool() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_bool() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with bool;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_double() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_double() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with double;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_int() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_int() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with int;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_Null() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_Null() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with Null;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_num() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_num() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with num;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_String() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_String() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with String;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfDisallowedClass_classTypeAlias_String_num() {
|
| + test_mixinOfDisallowedClass_classTypeAlias_String_num() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with String, num;''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfEnum() {
|
| + test_mixinOfEnum() async {
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A extends Object with E {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfNonClass_class() {
|
| + test_mixinOfNonClass_class() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B extends Object with A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinOfNonClass_typeAlias() {
|
| + test_mixinOfNonClass_typeAlias() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| int B;
|
| class C = A with B;''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinReferencesSuper() {
|
| + test_mixinReferencesSuper() async {
|
| Source source = addSource(r'''
|
| class A {
|
| toString() => super.toString();
|
| }
|
| class B extends Object with A {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
|
| + await assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinWithNonClassSuperclass_class() {
|
| + test_mixinWithNonClassSuperclass_class() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B {}
|
| class C extends A with B {}''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_mixinWithNonClassSuperclass_typeAlias() {
|
| + test_mixinWithNonClassSuperclass_typeAlias() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B {}
|
| class C = A with B;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_multipleRedirectingConstructorInvocations() {
|
| + test_multipleRedirectingConstructorInvocations() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() : this.a(), this.b();
|
| A.a() {}
|
| A.b() {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_multipleSuperInitializers() {
|
| + test_multipleSuperInitializers() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A {
|
| B() : super(), super() {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nativeClauseInNonSDKCode() {
|
| + test_nativeClauseInNonSDKCode() async {
|
| // TODO(jwren) Move this test somewhere else: This test verifies a parser
|
| // error code is generated through the ErrorVerifier, it is not a
|
| // CompileTimeErrorCode.
|
| Source source = addSource("class A native 'string' {}");
|
| - assertErrors(source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nativeFunctionBodyInNonSDKCode_function() {
|
| + test_nativeFunctionBodyInNonSDKCode_function() async {
|
| // TODO(jwren) Move this test somewhere else: This test verifies a parser
|
| // error code is generated through the ErrorVerifier, it is not a
|
| // CompileTimeErrorCode.
|
| Source source = addSource("int m(a) native 'string';");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nativeFunctionBodyInNonSDKCode_method() {
|
| + test_nativeFunctionBodyInNonSDKCode_method() async {
|
| // TODO(jwren) Move this test somewhere else: This test verifies a parser
|
| // error code is generated through the ErrorVerifier, it is not a
|
| // CompileTimeErrorCode.
|
| @@ -3694,12 +3802,12 @@ class B extends A {
|
| class A{
|
| static int m(a) native 'string';
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noAnnotationConstructorArguments() {
|
| + test_noAnnotationConstructorArguments() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -3707,12 +3815,12 @@ class A {
|
| @A
|
| main() {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit() {
|
| + test_noDefaultSuperConstructorExplicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(p);
|
| @@ -3720,12 +3828,12 @@ class A {
|
| class B extends A {
|
| B() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall() {
|
| + test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3737,12 +3845,12 @@ class C extends Mixed {
|
| C(x) : super();
|
| }
|
| ''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam() {
|
| + test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3754,12 +3862,12 @@ class C extends Mixed {
|
| C();
|
| }
|
| ''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall() {
|
| + test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3771,12 +3879,12 @@ class C extends Mixed {
|
| C(x) : super.named();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // Don't verify since call to super.named() can't be resolved.
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam() {
|
| + test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3788,12 +3896,12 @@ class C extends Mixed {
|
| C();
|
| }
|
| ''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall() {
|
| + test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3804,12 +3912,12 @@ class C extends B with M {
|
| C(x) : super();
|
| }
|
| ''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_mixinWithNamedParam() {
|
| + test_noDefaultSuperConstructorExplicit_mixinWithNamedParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3820,12 +3928,12 @@ class C extends B with M {
|
| C();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall() {
|
| + test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3836,12 +3944,12 @@ class C extends B with M {
|
| C(x) : super.named();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // Don't verify since call to super.named() can't be resolved.
|
| }
|
|
|
| - void test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam() {
|
| + test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3852,12 +3960,12 @@ class C extends B with M {
|
| C();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam() {
|
| + test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3867,12 +3975,12 @@ class B {
|
| class Mixed = B with M;
|
| class C extends Mixed {}
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam() {
|
| + test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3882,12 +3990,12 @@ class B {
|
| class Mixed = B with M;
|
| class C extends Mixed {}
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_mixinWithNamedParam() {
|
| + test_noDefaultSuperConstructorImplicit_mixinWithNamedParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3896,12 +4004,12 @@ class B {
|
| }
|
| class C extends B with M {}
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam() {
|
| + test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam() async {
|
| Source source = addSource(r'''
|
| class M {}
|
| class B {
|
| @@ -3910,33 +4018,33 @@ class B {
|
| }
|
| class C extends B with M {}
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_superHasParameters() {
|
| + test_noDefaultSuperConstructorImplicit_superHasParameters() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A(p);
|
| }
|
| class B extends A {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_noDefaultSuperConstructorImplicit_superOnlyNamed() {
|
| + test_noDefaultSuperConstructorImplicit_superOnlyNamed() async {
|
| Source source = addSource(r'''
|
| class A { A.named() {} }
|
| class B extends A {}''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantAnnotationConstructor_named() {
|
| + test_nonConstantAnnotationConstructor_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.fromInt() {}
|
| @@ -3944,12 +4052,12 @@ class A {
|
| @A.fromInt()
|
| main() {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantAnnotationConstructor_unnamed() {
|
| + test_nonConstantAnnotationConstructor_unnamed() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() {}
|
| @@ -3957,69 +4065,75 @@ class A {
|
| @A()
|
| main() {
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_function_named() {
|
| + test_nonConstantDefaultValue_function_named() async {
|
| Source source = addSource(r'''
|
| int y;
|
| f({x : y}) {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_function_positional() {
|
| + test_nonConstantDefaultValue_function_positional() async {
|
| Source source = addSource(r'''
|
| int y;
|
| f([x = y]) {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_inConstructor_named() {
|
| + test_nonConstantDefaultValue_inConstructor_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int y;
|
| A({x : y}) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_inConstructor_positional() {
|
| + test_nonConstantDefaultValue_inConstructor_positional() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int y;
|
| A([x = y]) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_method_named() {
|
| + test_nonConstantDefaultValue_method_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int y;
|
| m({x : y}) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValue_method_positional() {
|
| + test_nonConstantDefaultValue_method_positional() async {
|
| Source source = addSource(r'''
|
| class A {
|
| int y;
|
| m([x = y]) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstantDefaultValueFromDeferredLibrary() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstantDefaultValueFromDeferredLibrary() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const V = 1;''',
|
| @@ -4032,8 +4146,8 @@ f({x : a.V}) {}'''
|
| ]);
|
| }
|
|
|
| - void test_nonConstantDefaultValueFromDeferredLibrary_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstantDefaultValueFromDeferredLibrary_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const V = 1;''',
|
| @@ -4046,7 +4160,7 @@ f({x : a.V + 1}) {}'''
|
| ]);
|
| }
|
|
|
| - void test_nonConstCaseExpression() {
|
| + test_nonConstCaseExpression() async {
|
| Source source = addSource(r'''
|
| f(int p, int q) {
|
| switch (p) {
|
| @@ -4054,12 +4168,13 @@ f(int p, int q) {
|
| break;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstCaseExpressionFromDeferredLibrary() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstCaseExpressionFromDeferredLibrary() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4077,8 +4192,8 @@ main (int p) {
|
| ]);
|
| }
|
|
|
| - void test_nonConstCaseExpressionFromDeferredLibrary_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstCaseExpressionFromDeferredLibrary_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4096,17 +4211,18 @@ main (int p) {
|
| ]);
|
| }
|
|
|
| - void test_nonConstListElement() {
|
| + test_nonConstListElement() async {
|
| Source source = addSource(r'''
|
| f(a) {
|
| return const [a];
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstListElementFromDeferredLibrary() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstListElementFromDeferredLibrary() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4121,8 +4237,8 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstListElementFromDeferredLibrary_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstListElementFromDeferredLibrary_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4137,37 +4253,37 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstMapAsExpressionStatement_begin() {
|
| + test_nonConstMapAsExpressionStatement_begin() async {
|
| Source source = addSource(r'''
|
| f() {
|
| {'a' : 0, 'b' : 1}.length;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstMapAsExpressionStatement_only() {
|
| + test_nonConstMapAsExpressionStatement_only() async {
|
| Source source = addSource(r'''
|
| f() {
|
| {'a' : 0, 'b' : 1};
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstMapKey() {
|
| + test_nonConstMapKey() async {
|
| Source source = addSource(r'''
|
| f(a) {
|
| return const {a : 0};
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]);
|
| + await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstMapKeyFromDeferredLibrary() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstMapKeyFromDeferredLibrary() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4182,8 +4298,8 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstMapKeyFromDeferredLibrary_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstMapKeyFromDeferredLibrary_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4198,17 +4314,17 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstMapValue() {
|
| + test_nonConstMapValue() async {
|
| Source source = addSource(r'''
|
| f(a) {
|
| return const {'a' : a};
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]);
|
| + await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstMapValueFromDeferredLibrary() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstMapValueFromDeferredLibrary() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4223,8 +4339,8 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstMapValueFromDeferredLibrary_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstMapValueFromDeferredLibrary_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4239,93 +4355,93 @@ f() {
|
| ]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_assert_condition() {
|
| + test_nonConstValueInInitializer_assert_condition() async {
|
| resetWithOptions(new AnalysisOptionsImpl()..enableAssertInitializer = true);
|
| Source source = addSource(r'''
|
| class A {
|
| const A(int i) : assert(i.isNegative);
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_assert_message() {
|
| + test_nonConstValueInInitializer_assert_message() async {
|
| resetWithOptions(new AnalysisOptionsImpl()..enableAssertInitializer = true);
|
| Source source = addSource(r'''
|
| class A {
|
| const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}');
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_binary_notBool_left() {
|
| + test_nonConstValueInInitializer_binary_notBool_left() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final bool a;
|
| const A(String p) : a = p && true;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_binary_notBool_right() {
|
| + test_nonConstValueInInitializer_binary_notBool_right() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final bool a;
|
| const A(String p) : a = true && p;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_binary_notInt() {
|
| + test_nonConstValueInInitializer_binary_notInt() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final int a;
|
| const A(String p) : a = 5 & p;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_binary_notNum() {
|
| + test_nonConstValueInInitializer_binary_notNum() async {
|
| Source source = addSource(r'''
|
| class A {
|
| final int a;
|
| const A(String p) : a = 5 + p;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_field() {
|
| + test_nonConstValueInInitializer_field() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static int C;
|
| final int a;
|
| const A() : a = C;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_instanceCreation() {
|
| + test_nonConstValueInInitializer_instanceCreation() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A();
|
| @@ -4337,26 +4453,26 @@ class B {
|
| var b = const B();''');
|
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
|
| // suppressed.
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
|
| CompileTimeErrorCode.INVALID_CONSTANT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_redirecting() {
|
| + test_nonConstValueInInitializer_redirecting() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static var C;
|
| const A.named(p);
|
| const A() : this.named(C);
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializer_super() {
|
| + test_nonConstValueInInitializer_super() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A(p);
|
| @@ -4365,13 +4481,13 @@ class B extends A {
|
| static var C;
|
| const B() : super(C);
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonConstValueInInitializerFromDeferredLibrary_field() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstValueInInitializerFromDeferredLibrary_field() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4388,8 +4504,8 @@ class A {
|
| ]);
|
| }
|
|
|
| - void test_nonConstValueInInitializerFromDeferredLibrary_field_nested() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstValueInInitializerFromDeferredLibrary_field_nested() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4406,8 +4522,8 @@ class A {
|
| ]);
|
| }
|
|
|
| - void test_nonConstValueInInitializerFromDeferredLibrary_redirecting() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstValueInInitializerFromDeferredLibrary_redirecting() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4424,8 +4540,8 @@ class A {
|
| ]);
|
| }
|
|
|
| - void test_nonConstValueInInitializerFromDeferredLibrary_super() {
|
| - resolveWithErrors(<String>[
|
| + test_nonConstValueInInitializerFromDeferredLibrary_super() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| const int c = 1;''',
|
| @@ -4444,7 +4560,7 @@ class B extends A {
|
| ]);
|
| }
|
|
|
| - void test_nonGenerativeConstructor_explicit() {
|
| + test_nonGenerativeConstructor_explicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A.named() => null;
|
| @@ -4452,11 +4568,12 @@ class A {
|
| class B extends A {
|
| B() : super.named();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonGenerativeConstructor_implicit() {
|
| + test_nonGenerativeConstructor_implicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A() => null;
|
| @@ -4464,22 +4581,24 @@ class A {
|
| class B extends A {
|
| B();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_nonGenerativeConstructor_implicit2() {
|
| + test_nonGenerativeConstructor_implicit2() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A() => null;
|
| }
|
| class B extends A {
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_notEnoughRequiredArguments_const() {
|
| + test_notEnoughRequiredArguments_const() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A(int p);
|
| @@ -4487,11 +4606,12 @@ class A {
|
| main() {
|
| const A();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_notEnoughRequiredArguments_const_super() {
|
| + test_notEnoughRequiredArguments_const_super() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A(int p);
|
| @@ -4499,46 +4619,49 @@ class A {
|
| class B extends A {
|
| const B() : super();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_optionalParameterInOperator_named() {
|
| + test_optionalParameterInOperator_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| operator +({p}) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_optionalParameterInOperator_positional() {
|
| + test_optionalParameterInOperator_positional() async {
|
| Source source = addSource(r'''
|
| class A {
|
| operator +([p]) {}
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_partOfNonPart() {
|
| + test_partOfNonPart() async {
|
| Source source = addSource(r'''
|
| library l1;
|
| part 'l2.dart';''');
|
| addNamedSource("/l2.dart", "library l2;");
|
| - assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| + await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| verify([source]);
|
| }
|
|
|
| - void test_partOfNonPart_self() {
|
| + test_partOfNonPart_self() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'test.dart';''');
|
| - assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| + await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_assignment_compound_in_method() {
|
| + test_prefix_assignment_compound_in_method() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4548,12 +4671,12 @@ class C {
|
| }
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_assignment_compound_not_in_method() {
|
| + test_prefix_assignment_compound_not_in_method() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4561,12 +4684,12 @@ f() {
|
| p += 1;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_assignment_in_method() {
|
| + test_prefix_assignment_in_method() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4576,12 +4699,12 @@ class C {
|
| }
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_assignment_not_in_method() {
|
| + test_prefix_assignment_not_in_method() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4589,12 +4712,12 @@ f() {
|
| p = 1;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_call() {
|
| + test_prefix_conditionalPropertyAccess_call() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4607,12 +4730,12 @@ f() {
|
| p?.g();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_call_loadLibrary() {
|
| + test_prefix_conditionalPropertyAccess_call_loadLibrary() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4624,12 +4747,12 @@ f() {
|
| p?.loadLibrary();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_get() {
|
| + test_prefix_conditionalPropertyAccess_get() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4642,12 +4765,12 @@ f() {
|
| return p?.x;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_get_loadLibrary() {
|
| + test_prefix_conditionalPropertyAccess_get_loadLibrary() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4659,12 +4782,12 @@ f() {
|
| return p?.loadLibrary;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_set() {
|
| + test_prefix_conditionalPropertyAccess_set() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4677,12 +4800,12 @@ f() {
|
| p?.x = null;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_conditionalPropertyAccess_set_loadLibrary() {
|
| + test_prefix_conditionalPropertyAccess_set_loadLibrary() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4694,12 +4817,12 @@ f() {
|
| p?.loadLibrary = null;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_unqualified_invocation_in_method() {
|
| + test_prefix_unqualified_invocation_in_method() async {
|
| addNamedSource('/lib.dart', 'librarylib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4709,12 +4832,12 @@ class C {
|
| }
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefix_unqualified_invocation_not_in_method() {
|
| + test_prefix_unqualified_invocation_not_in_method() async {
|
| addNamedSource('/lib.dart', 'librarylib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4722,12 +4845,12 @@ f() {
|
| p();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() {
|
| + test_prefixCollidesWithTopLevelMembers_functionTypeAlias() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -4737,12 +4860,12 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| typedef p();
|
| p.A a;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixCollidesWithTopLevelMembers_topLevelFunction() {
|
| + test_prefixCollidesWithTopLevelMembers_topLevelFunction() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -4752,12 +4875,12 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| p() {}
|
| p.A a;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixCollidesWithTopLevelMembers_topLevelVariable() {
|
| + test_prefixCollidesWithTopLevelMembers_topLevelVariable() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -4767,12 +4890,12 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| var p = null;
|
| p.A a;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixCollidesWithTopLevelMembers_type() {
|
| + test_prefixCollidesWithTopLevelMembers_type() async {
|
| addNamedSource(
|
| "/lib.dart",
|
| r'''
|
| @@ -4782,12 +4905,12 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| class p {}
|
| p.A a;''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixNotFollowedByDot() {
|
| + test_prefixNotFollowedByDot() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4795,12 +4918,12 @@ f() {
|
| return p;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixNotFollowedByDot_compoundAssignment() {
|
| + test_prefixNotFollowedByDot_compoundAssignment() async {
|
| addNamedSource('/lib.dart', 'library lib;');
|
| Source source = addSource('''
|
| import 'lib.dart' as p;
|
| @@ -4808,12 +4931,12 @@ f() {
|
| p += 1;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_prefixNotFollowedByDot_conditionalMethodInvocation() {
|
| + test_prefixNotFollowedByDot_conditionalMethodInvocation() async {
|
| addNamedSource(
|
| '/lib.dart',
|
| '''
|
| @@ -4826,56 +4949,59 @@ f() {
|
| p?.g();
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_privateOptionalParameter() {
|
| + test_privateOptionalParameter() async {
|
| Source source = addSource("f({var _p}) {}");
|
| - assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_privateOptionalParameter_fieldFormal() {
|
| + test_privateOptionalParameter_fieldFormal() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var _p;
|
| A({this._p: 0});
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_privateOptionalParameter_withDefaultValue() {
|
| + test_privateOptionalParameter_withDefaultValue() async {
|
| Source source = addSource("f({_p : 0}) {}");
|
| - assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveCompileTimeConstant() {
|
| + test_recursiveCompileTimeConstant() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| final m = const A();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveCompileTimeConstant_cycle() {
|
| + test_recursiveCompileTimeConstant_cycle() async {
|
| Source source = addSource(r'''
|
| const x = y + 1;
|
| const y = x + 1;''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT,
|
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveCompileTimeConstant_initializer_after_toplevel_var() {
|
| + test_recursiveCompileTimeConstant_initializer_after_toplevel_var() async {
|
| Source source = addSource('''
|
| const y = const C();
|
| class C {
|
| @@ -4883,43 +5009,44 @@ class C {
|
| final x;
|
| }
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveCompileTimeConstant_singleVariable() {
|
| + test_recursiveCompileTimeConstant_singleVariable() async {
|
| Source source = addSource(r'''
|
| const x = x;
|
| ''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveConstructorRedirect() {
|
| + test_recursiveConstructorRedirect() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.a() : this.b();
|
| A.b() : this.a();
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveConstructorRedirect_directSelfReference() {
|
| + test_recursiveConstructorRedirect_directSelfReference() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() : this();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveFactoryRedirect() {
|
| + test_recursiveFactoryRedirect() async {
|
| Source source = addSource(r'''
|
| class A implements B {
|
| factory A() = C;
|
| @@ -4930,7 +5057,7 @@ class B implements C {
|
| class C implements A {
|
| factory C() = B;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -4941,16 +5068,17 @@ class C implements A {
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveFactoryRedirect_directSelfReference() {
|
| + test_recursiveFactoryRedirect_directSelfReference() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A() = A;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveFactoryRedirect_diverging() {
|
| + test_recursiveFactoryRedirect_diverging() async {
|
| // Analysis should terminate even though the redirections don't reach a
|
| // fixed point. (C<int> redirects to C<C<int>>, then to C<C<C<int>>>, and
|
| // so on).
|
| @@ -4962,11 +5090,12 @@ main() {
|
| const C<int>();
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveFactoryRedirect_generic() {
|
| + test_recursiveFactoryRedirect_generic() async {
|
| Source source = addSource(r'''
|
| class A<T> implements B<T> {
|
| factory A() = C;
|
| @@ -4977,7 +5106,7 @@ class B<T> implements C<T> {
|
| class C<T> implements A<T> {
|
| factory C() = B;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -4988,7 +5117,7 @@ class C<T> implements A<T> {
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveFactoryRedirect_named() {
|
| + test_recursiveFactoryRedirect_named() async {
|
| Source source = addSource(r'''
|
| class A implements B {
|
| factory A.nameA() = C.nameC;
|
| @@ -4999,7 +5128,7 @@ class B implements C {
|
| class C implements A {
|
| factory C.nameC() = B.nameB;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -5014,7 +5143,7 @@ class C implements A {
|
| * "A" references "C" which has cycle with "B". But we should not report problem for "A" - it is
|
| * not the part of a cycle.
|
| */
|
| - void test_recursiveFactoryRedirect_outsideCycle() {
|
| + test_recursiveFactoryRedirect_outsideCycle() async {
|
| Source source = addSource(r'''
|
| class A {
|
| factory A() = C;
|
| @@ -5025,7 +5154,7 @@ class B implements C {
|
| class C implements A, B {
|
| factory C() = B;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| @@ -5034,51 +5163,51 @@ class C implements A, B {
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_extends() {
|
| + test_recursiveInterfaceInheritance_extends() async {
|
| Source source = addSource(r'''
|
| class A extends B {}
|
| class B extends A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_extends_implements() {
|
| + test_recursiveInterfaceInheritance_extends_implements() async {
|
| Source source = addSource(r'''
|
| class A extends B {}
|
| class B implements A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_implements() {
|
| + test_recursiveInterfaceInheritance_implements() async {
|
| Source source = addSource(r'''
|
| class A implements B {}
|
| class B implements A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_mixin() {
|
| + test_recursiveInterfaceInheritance_mixin() async {
|
| Source source = addSource(r'''
|
| class M1 = Object with M2;
|
| class M2 = Object with M1;''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_mixin_superclass() {
|
| + test_recursiveInterfaceInheritance_mixin_superclass() async {
|
| // Make sure we don't get CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS in
|
| // addition--that would just be confusing.
|
| Source source = addSource('''
|
| @@ -5086,42 +5215,42 @@ class C = D with M;
|
| class D = C with M;
|
| class M {}
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_tail() {
|
| + test_recursiveInterfaceInheritance_tail() async {
|
| Source source = addSource(r'''
|
| abstract class A implements A {}
|
| class B implements A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_tail2() {
|
| + test_recursiveInterfaceInheritance_tail2() async {
|
| Source source = addSource(r'''
|
| abstract class A implements B {}
|
| abstract class B implements A {}
|
| class C implements A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritance_tail3() {
|
| + test_recursiveInterfaceInheritance_tail3() async {
|
| Source source = addSource(r'''
|
| abstract class A implements B {}
|
| abstract class B implements C {}
|
| abstract class C implements A {}
|
| class D implements A {}''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| @@ -5129,22 +5258,22 @@ class D implements A {}''');
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritanceBaseCaseExtends() {
|
| + test_recursiveInterfaceInheritanceBaseCaseExtends() async {
|
| Source source = addSource("class A extends A {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritanceBaseCaseExtends_abstract() {
|
| + test_recursiveInterfaceInheritanceBaseCaseExtends_abstract() async {
|
| Source source = addSource(r'''
|
| class C extends C {
|
| var bar = 0;
|
| m();
|
| }
|
| ''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS,
|
| StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
|
| StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
|
| @@ -5152,54 +5281,54 @@ class C extends C {
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritanceBaseCaseImplements() {
|
| + test_recursiveInterfaceInheritanceBaseCaseImplements() async {
|
| Source source = addSource("class A implements A {}");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias() {
|
| + test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class M {}
|
| class B = A with M implements B;''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_recursiveInterfaceInheritanceBaseCaseWith() {
|
| + test_recursiveInterfaceInheritanceBaseCaseWith() async {
|
| Source source = addSource("class M = Object with M;");
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH]);
|
| verify([source]);
|
| }
|
|
|
| - void test_redirectGenerativeToMissingConstructor() {
|
| + test_redirectGenerativeToMissingConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() : this.noSuchConstructor();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| - void test_redirectGenerativeToNonGenerativeConstructor() {
|
| + test_redirectGenerativeToNonGenerativeConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() : this.x();
|
| factory A.x() => null;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_redirectToMissingConstructor_named() {
|
| + test_redirectToMissingConstructor_named() async {
|
| Source source = addSource(r'''
|
| class A implements B{
|
| A() {}
|
| @@ -5207,11 +5336,11 @@ class A implements B{
|
| class B {
|
| const factory B() = A.name;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| - void test_redirectToMissingConstructor_unnamed() {
|
| + test_redirectToMissingConstructor_unnamed() async {
|
| Source source = addSource(r'''
|
| class A implements B{
|
| A.name() {}
|
| @@ -5219,41 +5348,41 @@ class A implements B{
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| - void test_redirectToNonClass_notAType() {
|
| + test_redirectToNonClass_notAType() async {
|
| Source source = addSource(r'''
|
| int A;
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_redirectToNonClass_undefinedIdentifier() {
|
| + test_redirectToNonClass_undefinedIdentifier() async {
|
| Source source = addSource(r'''
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_redirectToNonConstConstructor() {
|
| + test_redirectToNonConstConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.a() {}
|
| const factory A.b() = A.a;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_hideInBlock_function() {
|
| + test_referencedBeforeDeclaration_hideInBlock_function() async {
|
| Source source = addSource(r'''
|
| var v = 1;
|
| main() {
|
| @@ -5261,10 +5390,11 @@ main() {
|
| v() {}
|
| }
|
| print(x) {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_hideInBlock_local() {
|
| + test_referencedBeforeDeclaration_hideInBlock_local() async {
|
| Source source = addSource(r'''
|
| var v = 1;
|
| main() {
|
| @@ -5272,10 +5402,11 @@ main() {
|
| var v = 2;
|
| }
|
| print(x) {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_hideInBlock_subBlock() {
|
| + test_referencedBeforeDeclaration_hideInBlock_subBlock() async {
|
| Source source = addSource(r'''
|
| var v = 1;
|
| main() {
|
| @@ -5285,94 +5416,99 @@ main() {
|
| var v = 2;
|
| }
|
| print(x) {}''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_inInitializer_closure() {
|
| + test_referencedBeforeDeclaration_inInitializer_closure() async {
|
| Source source = addSource(r'''
|
| main() {
|
| var v = () => v;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_inInitializer_directly() {
|
| + test_referencedBeforeDeclaration_inInitializer_directly() async {
|
| Source source = addSource(r'''
|
| main() {
|
| var v = v;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_type_localFunction() {
|
| + test_referencedBeforeDeclaration_type_localFunction() async {
|
| Source source = addSource(r'''
|
| void testTypeRef() {
|
| String s = '';
|
| int String(int x) => x + 1;
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_referencedBeforeDeclaration_type_localVariable() {
|
| + test_referencedBeforeDeclaration_type_localVariable() async {
|
| Source source = addSource(r'''
|
| void testTypeRef() {
|
| String s = '';
|
| var String = '';
|
| }
|
| ''');
|
| - assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| - void test_rethrowOutsideCatch() {
|
| + test_rethrowOutsideCatch() async {
|
| Source source = addSource(r'''
|
| f() {
|
| rethrow;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
|
| + await assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
|
| verify([source]);
|
| }
|
|
|
| - void test_returnInGenerativeConstructor() {
|
| + test_returnInGenerativeConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() { return 0; }
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_returnInGenerativeConstructor_expressionFunctionBody() {
|
| + test_returnInGenerativeConstructor_expressionFunctionBody() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A() => null;
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_returnInGenerator_asyncStar() {
|
| + test_returnInGenerator_asyncStar() async {
|
| Source source = addSource(r'''
|
| f() async* {
|
| return 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| + await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_returnInGenerator_syncStar() {
|
| + test_returnInGenerator_syncStar() async {
|
| Source source = addSource(r'''
|
| f() sync* {
|
| return 0;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| + await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_sharedDeferredPrefix() {
|
| - resolveWithErrors(<String>[
|
| + test_sharedDeferredPrefix() async {
|
| + await resolveWithErrors(<String>[
|
| r'''
|
| library lib1;
|
| f1() {}''',
|
| @@ -5389,13 +5525,14 @@ main() { lib.f1(); lib.f2(); }'''
|
| ]);
|
| }
|
|
|
| - void test_superInInvalidContext_binaryExpression() {
|
| + test_superInInvalidContext_binaryExpression() async {
|
| Source source = addSource("var v = super + 0;");
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.v' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_constructorFieldInitializer() {
|
| + test_superInInvalidContext_constructorFieldInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -5404,11 +5541,12 @@ class B extends A {
|
| var f;
|
| B() : f = super.m();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_factoryConstructor() {
|
| + test_superInInvalidContext_factoryConstructor() async {
|
| Source source = addSource(r'''
|
| class A {
|
| m() {}
|
| @@ -5419,11 +5557,12 @@ class B extends A {
|
| return null;
|
| }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_instanceVariableInitializer() {
|
| + test_superInInvalidContext_instanceVariableInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| var a;
|
| @@ -5431,11 +5570,12 @@ class A {
|
| class B extends A {
|
| var b = super.a;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.a' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_staticMethod() {
|
| + test_superInInvalidContext_staticMethod() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static m() {}
|
| @@ -5443,11 +5583,12 @@ class A {
|
| class B extends A {
|
| static n() { return super.m(); }
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_staticVariableInitializer() {
|
| + test_superInInvalidContext_staticVariableInitializer() async {
|
| Source source = addSource(r'''
|
| class A {
|
| static int a = 0;
|
| @@ -5455,57 +5596,60 @@ class A {
|
| class B extends A {
|
| static int b = super.a;
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.a' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_topLevelFunction() {
|
| + test_superInInvalidContext_topLevelFunction() async {
|
| Source source = addSource(r'''
|
| f() {
|
| super.f();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.f' is not resolved
|
| }
|
|
|
| - void test_superInInvalidContext_topLevelVariableInitializer() {
|
| + test_superInInvalidContext_topLevelVariableInitializer() async {
|
| Source source = addSource("var v = super.y;");
|
| - assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.y' is not resolved
|
| }
|
|
|
| - void test_superInRedirectingConstructor_redirectionSuper() {
|
| + test_superInRedirectingConstructor_redirectionSuper() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B {
|
| B() : this.name(), super();
|
| B.name() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_superInRedirectingConstructor_superRedirection() {
|
| + test_superInRedirectingConstructor_superRedirection() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B {
|
| B() : super(), this.name();
|
| B.name() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| - void test_symbol_constructor_badArgs() {
|
| + test_symbol_constructor_badArgs() async {
|
| Source source = addSource(r'''
|
| var s1 = const Symbol('3');
|
| var s2 = const Symbol(3);
|
| var s3 = const Symbol();
|
| var s4 = const Symbol('x', 'y');
|
| var s5 = const Symbol('x', foo: 'x');''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
|
| @@ -5516,21 +5660,21 @@ var s5 = const Symbol('x', foo: 'x');''');
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_11987() {
|
| + test_typeAliasCannotReferenceItself_11987() async {
|
| Source source = addSource(r'''
|
| typedef void F(List<G> l);
|
| typedef void G(List<F> l);
|
| main() {
|
| F foo(G g) => g;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_19459() {
|
| + test_typeAliasCannotReferenceItself_19459() async {
|
| // A complex example involving multiple classes. This is legal, since
|
| // typedef F references itself only via a class.
|
| Source source = addSource(r'''
|
| @@ -5541,39 +5685,39 @@ abstract class D {
|
| abstract class E extends A<dynamic, F> {}
|
| typedef D F();
|
| ''');
|
| - assertNoErrors(source);
|
| + await assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_parameterType_named() {
|
| + test_typeAliasCannotReferenceItself_parameterType_named() async {
|
| Source source = addSource("typedef A({A a});");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_parameterType_positional() {
|
| + test_typeAliasCannotReferenceItself_parameterType_positional() async {
|
| Source source = addSource("typedef A([A a]);");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_parameterType_required() {
|
| + test_typeAliasCannotReferenceItself_parameterType_required() async {
|
| Source source = addSource("typedef A(A a);");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_parameterType_typeArgument() {
|
| + test_typeAliasCannotReferenceItself_parameterType_typeArgument() async {
|
| Source source = addSource("typedef A(List<A> a);");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() {
|
| + test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() async {
|
| // A typedef is allowed to indirectly reference itself via a class.
|
| Source source = addSource(r'''
|
| typedef C A();
|
| @@ -5581,36 +5725,36 @@ typedef A B();
|
| class C {
|
| B a;
|
| }''');
|
| - assertNoErrors(source);
|
| + await assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_returnType() {
|
| + test_typeAliasCannotReferenceItself_returnType() async {
|
| Source source = addSource("typedef A A();");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_returnType_indirect() {
|
| + test_typeAliasCannotReferenceItself_returnType_indirect() async {
|
| Source source = addSource(r'''
|
| typedef B A();
|
| typedef A B();''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
|
| ]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeAliasCannotReferenceItself_typeVariableBounds() {
|
| + test_typeAliasCannotReferenceItself_typeVariableBounds() async {
|
| Source source = addSource("typedef A<T extends A>();");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| - void test_typeArgumentNotMatchingBounds_const() {
|
| + test_typeArgumentNotMatchingBounds_const() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B {}
|
| @@ -5618,32 +5762,32 @@ class G<E extends A> {
|
| const G();
|
| }
|
| f() { return const G<B>(); }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_undefinedClass_const() {
|
| + test_undefinedClass_const() async {
|
| Source source = addSource(r'''
|
| f() {
|
| return const A();
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]);
|
| + await assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| - void test_undefinedConstructorInInitializer_explicit_named() {
|
| + test_undefinedConstructorInInitializer_explicit_named() async {
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A {
|
| B() : super.named();
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // no verify(), "super.named()" is not resolved
|
| }
|
|
|
| - void test_undefinedConstructorInInitializer_explicit_unnamed() {
|
| + test_undefinedConstructorInInitializer_explicit_unnamed() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.named() {}
|
| @@ -5651,12 +5795,12 @@ class A {
|
| class B extends A {
|
| B() : super();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_undefinedConstructorInInitializer_implicit() {
|
| + test_undefinedConstructorInInitializer_implicit() async {
|
| Source source = addSource(r'''
|
| class A {
|
| A.named() {}
|
| @@ -5664,12 +5808,12 @@ class A {
|
| class B extends A {
|
| B();
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| - void test_undefinedNamedParameter() {
|
| + test_undefinedNamedParameter() async {
|
| Source source = addSource(r'''
|
| class A {
|
| const A();
|
| @@ -5677,36 +5821,37 @@ class A {
|
| main() {
|
| const A(p: 0);
|
| }''');
|
| - assertErrors(source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]);
|
| // no verify(), 'p' is not resolved
|
| }
|
|
|
| - void test_uriDoesNotExist_export() {
|
| + test_uriDoesNotExist_export() async {
|
| Source source = addSource("export 'unknown.dart';");
|
| - assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| - void test_uriDoesNotExist_import() {
|
| + test_uriDoesNotExist_import() async {
|
| Source source = addSource("import 'unknown.dart';");
|
| - assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| - void test_uriDoesNotExist_import_appears_after_deleting_target() {
|
| + test_uriDoesNotExist_import_appears_after_deleting_target() async {
|
| Source test = addSource("import 'target.dart';");
|
| Source target = addNamedSource("/target.dart", "");
|
| - assertErrors(test, [HintCode.UNUSED_IMPORT]);
|
| + await assertErrors(test, [HintCode.UNUSED_IMPORT]);
|
|
|
| // Remove the overlay in the same way as AnalysisServer.
|
| analysisContext2.setContents(target, null);
|
| ChangeSet changeSet = new ChangeSet()..removedSource(target);
|
| analysisContext2.applyChanges(changeSet);
|
|
|
| - assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| - void test_uriDoesNotExist_import_disappears_when_fixed() {
|
| + test_uriDoesNotExist_import_disappears_when_fixed() async {
|
| Source source = addSource("import 'target.dart';");
|
| - assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
|
|
| // Check that the file is represented as missing.
|
| Source target = analysisContext2
|
| @@ -5720,19 +5865,19 @@ main() {
|
| ..handleContentsChanged(target, null, "", true);
|
|
|
| // Make sure the error goes away.
|
| - assertErrors(source, [HintCode.UNUSED_IMPORT]);
|
| + await assertErrors(source, [HintCode.UNUSED_IMPORT]);
|
| }
|
|
|
| - void test_uriDoesNotExist_part() {
|
| + test_uriDoesNotExist_part() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'unknown.dart';''');
|
| - assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| - void test_uriWithInterpolation_constant() {
|
| + test_uriWithInterpolation_constant() async {
|
| Source source = addSource("import 'stuff_\$platform.dart';");
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.URI_WITH_INTERPOLATION,
|
| StaticWarningCode.UNDEFINED_IDENTIFIER
|
| ]);
|
| @@ -5740,165 +5885,172 @@ part 'unknown.dart';''');
|
| // URI: 'stuff_$platform.dart'
|
| }
|
|
|
| - void test_uriWithInterpolation_nonConstant() {
|
| + test_uriWithInterpolation_nonConstant() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part '${'a'}.dart';''');
|
| - assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]);
|
| + await assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]);
|
| // We cannot verify resolution with an unresolvable URI: '${'a'}.dart'
|
| }
|
|
|
| - void test_wrongNumberOfParametersForOperator1() {
|
| - _check_wrongNumberOfParametersForOperator1("<");
|
| - _check_wrongNumberOfParametersForOperator1(">");
|
| - _check_wrongNumberOfParametersForOperator1("<=");
|
| - _check_wrongNumberOfParametersForOperator1(">=");
|
| - _check_wrongNumberOfParametersForOperator1("+");
|
| - _check_wrongNumberOfParametersForOperator1("/");
|
| - _check_wrongNumberOfParametersForOperator1("~/");
|
| - _check_wrongNumberOfParametersForOperator1("*");
|
| - _check_wrongNumberOfParametersForOperator1("%");
|
| - _check_wrongNumberOfParametersForOperator1("|");
|
| - _check_wrongNumberOfParametersForOperator1("^");
|
| - _check_wrongNumberOfParametersForOperator1("&");
|
| - _check_wrongNumberOfParametersForOperator1("<<");
|
| - _check_wrongNumberOfParametersForOperator1(">>");
|
| - _check_wrongNumberOfParametersForOperator1("[]");
|
| + test_wrongNumberOfParametersForOperator1() async {
|
| + await _check_wrongNumberOfParametersForOperator1("<");
|
| + await _check_wrongNumberOfParametersForOperator1(">");
|
| + await _check_wrongNumberOfParametersForOperator1("<=");
|
| + await _check_wrongNumberOfParametersForOperator1(">=");
|
| + await _check_wrongNumberOfParametersForOperator1("+");
|
| + await _check_wrongNumberOfParametersForOperator1("/");
|
| + await _check_wrongNumberOfParametersForOperator1("~/");
|
| + await _check_wrongNumberOfParametersForOperator1("*");
|
| + await _check_wrongNumberOfParametersForOperator1("%");
|
| + await _check_wrongNumberOfParametersForOperator1("|");
|
| + await _check_wrongNumberOfParametersForOperator1("^");
|
| + await _check_wrongNumberOfParametersForOperator1("&");
|
| + await _check_wrongNumberOfParametersForOperator1("<<");
|
| + await _check_wrongNumberOfParametersForOperator1(">>");
|
| + await _check_wrongNumberOfParametersForOperator1("[]");
|
| }
|
|
|
| - void test_wrongNumberOfParametersForOperator_minus() {
|
| + test_wrongNumberOfParametersForOperator_minus() async {
|
| Source source = addSource(r'''
|
| class A {
|
| operator -(a, b) {}
|
| }''');
|
| - assertErrors(source,
|
| + await assertErrors(source,
|
| [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS]);
|
| verify([source]);
|
| reset();
|
| }
|
|
|
| - void test_wrongNumberOfParametersForOperator_tilde() {
|
| - _check_wrongNumberOfParametersForOperator("~", "a");
|
| - _check_wrongNumberOfParametersForOperator("~", "a, b");
|
| + test_wrongNumberOfParametersForOperator_tilde() async {
|
| + await _check_wrongNumberOfParametersForOperator("~", "a");
|
| + await _check_wrongNumberOfParametersForOperator("~", "a, b");
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_function_named() {
|
| + test_wrongNumberOfParametersForSetter_function_named() async {
|
| Source source = addSource("set x({p}) {}");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_function_optional() {
|
| + test_wrongNumberOfParametersForSetter_function_optional() async {
|
| Source source = addSource("set x([p]) {}");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_function_tooFew() {
|
| + test_wrongNumberOfParametersForSetter_function_tooFew() async {
|
| Source source = addSource("set x() {}");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_function_tooMany() {
|
| + test_wrongNumberOfParametersForSetter_function_tooMany() async {
|
| Source source = addSource("set x(a, b) {}");
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_method_named() {
|
| + test_wrongNumberOfParametersForSetter_method_named() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x({p}) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_method_optional() {
|
| + test_wrongNumberOfParametersForSetter_method_optional() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x([p]) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_method_tooFew() {
|
| + test_wrongNumberOfParametersForSetter_method_tooFew() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x() {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_wrongNumberOfParametersForSetter_method_tooMany() {
|
| + test_wrongNumberOfParametersForSetter_method_tooMany() async {
|
| Source source = addSource(r'''
|
| class A {
|
| set x(a, b) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_yield_used_as_identifier_in_async_method() {
|
| + test_yield_used_as_identifier_in_async_method() async {
|
| Source source = addSource('''
|
| f() async {
|
| var yield = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_yield_used_as_identifier_in_async_star_method() {
|
| + test_yield_used_as_identifier_in_async_star_method() async {
|
| Source source = addSource('''
|
| f() async* {
|
| var yield = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void test_yield_used_as_identifier_in_sync_star_method() {
|
| + test_yield_used_as_identifier_in_sync_star_method() async {
|
| Source source = addSource('''
|
| f() sync* {
|
| var yield = 1;
|
| }
|
| ''');
|
| - assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await assertErrors(
|
| + source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| - void _check_constEvalThrowsException_binary_null(String expr, bool resolved) {
|
| + Future<Null> _check_constEvalThrowsException_binary_null(
|
| + String expr, bool resolved) async {
|
| Source source = addSource("const C = $expr;");
|
| if (resolved) {
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| verify([source]);
|
| } else {
|
| - assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await assertErrors(
|
| + source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), 'null x' is not resolved
|
| }
|
| reset();
|
| }
|
|
|
| - void _check_constEvalTypeBool_withParameter_binary(String expr) {
|
| + Future<Null> _check_constEvalTypeBool_withParameter_binary(
|
| + String expr) async {
|
| Source source = addSource('''
|
| class A {
|
| final a;
|
| const A(bool p) : a = $expr;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| @@ -5906,13 +6058,13 @@ class A {
|
| reset();
|
| }
|
|
|
| - void _check_constEvalTypeInt_withParameter_binary(String expr) {
|
| + Future<Null> _check_constEvalTypeInt_withParameter_binary(String expr) async {
|
| Source source = addSource('''
|
| class A {
|
| final a;
|
| const A(int p) : a = $expr;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -5920,13 +6072,13 @@ class A {
|
| reset();
|
| }
|
|
|
| - void _check_constEvalTypeNum_withParameter_binary(String expr) {
|
| + Future<Null> _check_constEvalTypeNum_withParameter_binary(String expr) async {
|
| Source source = addSource('''
|
| class A {
|
| final a;
|
| const A(num p) : a = $expr;
|
| }''');
|
| - assertErrors(source, [
|
| + await assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -5934,20 +6086,20 @@ class A {
|
| reset();
|
| }
|
|
|
| - void _check_wrongNumberOfParametersForOperator(
|
| - String name, String parameters) {
|
| + Future<Null> _check_wrongNumberOfParametersForOperator(
|
| + String name, String parameters) async {
|
| Source source = addSource('''
|
| class A {
|
| operator $name($parameters) {}
|
| }''');
|
| - assertErrors(
|
| + await assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
|
| verify([source]);
|
| reset();
|
| }
|
|
|
| - void _check_wrongNumberOfParametersForOperator1(String name) {
|
| - _check_wrongNumberOfParametersForOperator(name, "");
|
| - _check_wrongNumberOfParametersForOperator(name, "a, b");
|
| + Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
|
| + await _check_wrongNumberOfParametersForOperator(name, "");
|
| + await _check_wrongNumberOfParametersForOperator(name, "a, b");
|
| }
|
| }
|
|
|