| Index: pkg/analyzer/test/src/task/strong/checker_test.dart
|
| diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
|
| index 9013f2121b5871f8a4c578d7762c3a64a3b1ea90..40fd228e7fe5f1c153c233972c775c37199d158d 100644
|
| --- a/pkg/analyzer/test/src/task/strong/checker_test.dart
|
| +++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
|
| @@ -9,12 +9,34 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| import 'strong_test_helper.dart';
|
|
|
| void main() {
|
| - initStrongModeTests();
|
| - defineReflectiveTests(CheckerTest);
|
| + defineReflectiveSuite(() {
|
| + defineReflectiveTests(CheckerTest);
|
| + });
|
| +}
|
| +
|
| +void _addMetaLibrary() {
|
| + addFile(
|
| + r'''
|
| +library meta;
|
| +class _Checked { const _Checked(); }
|
| +const Object checked = const _Checked();
|
| +
|
| +class _Virtual { const _Virtual(); }
|
| +const Object virtual = const _Virtual();
|
| + ''',
|
| + name: '/meta.dart');
|
| }
|
|
|
| @reflectiveTest
|
| class CheckerTest {
|
| + void setUp() {
|
| + doSetUp();
|
| + }
|
| +
|
| + void tearDown() {
|
| + doTearDown();
|
| + }
|
| +
|
| void test_awaitForInCastsStreamElementToVariable() {
|
| checkFile('''
|
| import 'dart:async';
|
| @@ -239,6 +261,20 @@ class T1 implements I2 {
|
| ''');
|
| }
|
|
|
| + void test_compoundAssignment_returnsDynamic() {
|
| + checkFile(r'''
|
| +class Foo {
|
| + operator +(other) => null;
|
| +}
|
| +
|
| +main() {
|
| + var foo = new Foo();
|
| + foo = /*info:DYNAMIC_CAST*/foo + 1;
|
| + /*info:DYNAMIC_CAST*/foo += 1;
|
| +}
|
| + ''');
|
| + }
|
| +
|
| void test_compoundAssignments() {
|
| checkFile('''
|
| class A {
|
| @@ -380,20 +416,6 @@ main() {
|
| ''');
|
| }
|
|
|
| - void test_compoundAssignment_returnsDynamic() {
|
| - checkFile(r'''
|
| -class Foo {
|
| - operator +(other) => null;
|
| -}
|
| -
|
| -main() {
|
| - var foo = new Foo();
|
| - foo = /*info:DYNAMIC_CAST*/foo + 1;
|
| - /*info:DYNAMIC_CAST*/foo += 1;
|
| -}
|
| - ''');
|
| - }
|
| -
|
| void test_constructorInvalid() {
|
| // Regression test for https://github.com/dart-lang/sdk/issues/26695
|
| checkFile('''
|
| @@ -3175,34 +3197,34 @@ abstract class D extends C {
|
| check(implicitCasts: false);
|
| }
|
|
|
| - void test_overrideNarrowsType_noDuplicateError() {
|
| + void test_overrideNarrowsType_legalWithChecked() {
|
| // Regression test for https://github.com/dart-lang/sdk/issues/25232
|
| _addMetaLibrary();
|
| checkFile(r'''
|
| import 'meta.dart';
|
| abstract class A { void test(A arg) { } }
|
| -abstract class B extends A {
|
| - /*error:INVALID_METHOD_OVERRIDE*/void test(B arg) { }
|
| -}
|
| +abstract class B extends A { void test(@checked B arg) { } }
|
| abstract class X implements A { }
|
| class C extends B with X { }
|
| -
|
| -// We treat "implements A" as asking for another check.
|
| -// This feels inconsistent to me.
|
| -class D /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B implements A { }
|
| +class D extends B implements A { }
|
| ''');
|
| }
|
|
|
| - void test_overrideNarrowsType_legalWithChecked() {
|
| + void test_overrideNarrowsType_noDuplicateError() {
|
| // Regression test for https://github.com/dart-lang/sdk/issues/25232
|
| _addMetaLibrary();
|
| checkFile(r'''
|
| import 'meta.dart';
|
| abstract class A { void test(A arg) { } }
|
| -abstract class B extends A { void test(@checked B arg) { } }
|
| +abstract class B extends A {
|
| + /*error:INVALID_METHOD_OVERRIDE*/void test(B arg) { }
|
| +}
|
| abstract class X implements A { }
|
| class C extends B with X { }
|
| -class D extends B implements A { }
|
| +
|
| +// We treat "implements A" as asking for another check.
|
| +// This feels inconsistent to me.
|
| +class D /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B implements A { }
|
| ''');
|
| }
|
|
|
| @@ -3945,14 +3967,3 @@ void main () {
|
| ''');
|
| }
|
| }
|
| -
|
| -void _addMetaLibrary() {
|
| - addFile(r'''
|
| -library meta;
|
| -class _Checked { const _Checked(); }
|
| -const Object checked = const _Checked();
|
| -
|
| -class _Virtual { const _Virtual(); }
|
| -const Object virtual = const _Virtual();
|
| - ''', name: '/meta.dart');
|
| -}
|
|
|