dart-sdk/tests/language/malformed/inheritance_test.dart
Jake Macdonald 3b06df241f Clean up a number of 2.19 opt outs in language tests.
This is less than half of them, will send some other chunks later.

Bug:51557
Change-Id: I4e80812a689fde99e23c34b6405aaf57cd431ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289261
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-17 16:17:50 +00:00

147 lines
3.8 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.
// Tests that malformed types used in extends, implements, and with clauses
// cause compile-time errors.
mixin class A<T> {}
class C
extends Unresolved
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
// [cfe] Type 'Unresolved' not found.
{
}
class C1
extends A<Unresolved>
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
class C2
// ^
// [cfe] The type 'Unresolved' can't be mixed in.
extends Object with Unresolved
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
// [cfe] Type 'Unresolved' not found.
{
}
class C3
extends Object with A<Unresolved>
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
class C4
implements Unresolved
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
// [cfe] Type 'Unresolved' not found.
{
}
class C5
implements A<Unresolved>
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
class C6<A>
extends A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
{
}
class C7<A>
extends A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
class C8<A>
// ^
// [cfe] The type 'A<int>' can't be mixed in.
extends Object with A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
{
}
class C9<A>
// ^
// [cfe] The type 'A<Unresolved>' can't be mixed in.
extends Object with A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
class C10<A>
implements A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
{
}
class C11<A>
implements A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
// [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
{
}
void main() {
new C();
new C1();
new C2();
new C3();
new C4();
new C5();
new C6<Object>();
new C7<Object>();
new C8<Object>();
new C9<Object>();
new C10<Object>();
new C11<Object>();
}