mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:37:12 +00:00
7ca5ad46ce
Mark tests that contain errors about using a class as a mixin to use language version 2.19 where that's not an error. This may not fix all of the tests because it's the language version of the library where the class is declared that matters, not where the class is used as a mixin. But most tests have all of their declarations in the same library, so this should fix most. Change-Id: I910439ebd2f10f731418dc588b7e4619a0841c16 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285923 Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Jake Macdonald <jakemac@google.com>
122 lines
3.7 KiB
Dart
122 lines
3.7 KiB
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// TODO(51557): Decide if the mixins being applied in this test should be
|
|
// "mixin", "mixin class" or the test should be left at 2.19.
|
|
// @dart=2.19
|
|
|
|
class M0 {
|
|
factory M0(a, b, c) => throw "uncalled";
|
|
factory M0.named() => throw "uncalled";
|
|
}
|
|
|
|
class M1 {
|
|
M1();
|
|
}
|
|
|
|
class M2 {
|
|
M2.named();
|
|
}
|
|
|
|
class C0 = Object with M0;
|
|
class C1 = Object with M1;
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class C2 = Object with M2;
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class C3 = Object with M0, M1;
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class C4 = Object with M1, M0;
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class C5 = Object with M0, M2;
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class C6 = Object with M2, M0;
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
|
|
class D0 extends Object with M0 {}
|
|
class D1 extends Object with M1 { }
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class D2 extends Object with M2 { }
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class D3 extends Object with M0, M1 { }
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class D4 extends Object with M1, M0 { }
|
|
// ^
|
|
// [cfe] Can't use 'M1' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class D5 extends Object with M0, M2 { }
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
class D6 extends Object with M2, M0 { }
|
|
// ^
|
|
// [cfe] Can't use 'M2' as a mixin because it has constructors.
|
|
// ^^
|
|
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
|
|
|
main() {
|
|
new C0();
|
|
new C1();
|
|
new C2();
|
|
new C3();
|
|
new C4();
|
|
new C5();
|
|
new C6();
|
|
|
|
new D0();
|
|
new D1();
|
|
new D2();
|
|
new D3();
|
|
new D4();
|
|
new D5();
|
|
new D6();
|
|
|
|
new C0(1,2,3);
|
|
// ^
|
|
// [cfe] Too many positional arguments: 0 allowed, but 3 found.
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
|
|
new C0.named();
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR
|
|
// [cfe] Couldn't find constructor 'C0.named'.
|
|
new D0(1,2,3);
|
|
// ^
|
|
// [cfe] Too many positional arguments: 0 allowed, but 3 found.
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
|
|
new D0.named();
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR
|
|
// [cfe] Couldn't find constructor 'D0.named'.
|
|
}
|