blob: f1a5ef7ddc0ec01ba0c08a29328ebd12c92e1278 [file] [log] [blame]
// Copyright (c) 2021, 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.
/// @assertion We do not allow dynamic explicit instantiation. If an expression
/// e has type dynamic (or Never), then e.foo<int> is a compile-time error for
/// any name foo. (It'd be valid for a member of Object that was a generic
/// function, but none of the Object members are generic functions). It's not
/// possible to do implicit instantiation without knowing the member signature.
///
/// @description Checks that dynamic explicit instantiation is a compile-time
/// error
/// @author sgrekhov@unipro.ru
// SharedOptions=--enable-experiment=constructor-tearoffs
dynamic f(dynamic x) => x;
class C {
T instanceMethod<T>(T t) => t;
}
main() {
C c = new C();
var v1 = f(c).instanceMethod<int>;
// ^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}