dart-sdk/tests/language/nonfunction_type_aliases/usage_object_error_test.dart
Jake Macdonald 3643e771c4 [flip-modifiers] opt out from class modifiers some failing front end language tests
Change-Id: I7c6473b2c1dd401355b18b55c8d3ce9b0cfaf257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286541
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-02 20:40:20 +00:00

57 lines
1.5 KiB
Dart

// Copyright (c) 2019, 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(https://github.com/dart-lang/sdk/issues/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
// Introduce an aliased type.
typedef T = Object;
// Use the aliased type.
abstract class C {
T? v10;
final T v12;
C(): v12 = T();
C.name1(this.v10, this.v12);
factory C.name2(T arg1, T arg2) = C1.name1;
}
class C1 implements C {
C1.name1(T arg1, T arg2);
noSuchMethod(Invocation invocation) => throw 0;
}
abstract class D2 extends C with T {}
// ^
// [analyzer] unspecified
// [cfe] Can't use 'Object' as a mixin because it has constructors.
abstract class D3 implements T {}
// ^
// [analyzer] unspecified
// [cfe] 'Object' can't be used in both 'extends' and 'implements' clauses.
abstract class D4 = C with T;
// ^
// [analyzer] unspecified
// [cfe] Can't use 'Object' as a mixin because it has constructors.
main() {
T.named();
// ^^^^^
// [analyzer] unspecified
// [cfe] Member not found: 'Object.named'.
T.staticMethod<T>();
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Member not found: 'Object.staticMethod'.
}