blob: e30bab00fb8562e2efa0c9002b5512e8fa27859a [file] [log] [blame]
// 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.
// @dart = 2.9
// Requirements=nnbd-weak
// SharedOptions=--enable-experiment=nonfunction-type-aliases
// Test that a type alias `T` denoting `Object`
// can give rise to the expected errors.
import 'usage_object_error_lib.dart';
// 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] unspecified
abstract class D3 implements T {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
abstract class D4 = C with T;
// ^
// [analyzer] unspecified
// [cfe] unspecified
main() {
T.named();
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
T.staticMethod<T>();
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] Method not found: 'Object.staticMethod'.
// ^^^^^^^^^^^^
// [cfe] A constructor invocation can't have type arguments on the constructor name.
}