blob: 7ed8dc1525a6b6f65dda92c699cc0debc1647a16 [file] [log] [blame]
// Copyright (c) 2018, 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.
////////////////////////////////////////////////////////////////////////////////
/// Explicit is-test is required even with --omit-implicit-checks.
////////////////////////////////////////////////////////////////////////////////
/*element: Class1.:hasThis*/
class Class1<T> {
/*element: Class1.method1:hasThis*/
method1(dynamic o) {
/*fields=[o,this],free=[o,this],hasThis*/
dynamic local() => o is T;
return local;
}
}
////////////////////////////////////////////////////////////////////////////////
/// Explicit as-cast is required even with --omit-implicit-checks.
////////////////////////////////////////////////////////////////////////////////
/*element: Class2.:hasThis*/
class Class2<T> {
/*element: Class2.method2:hasThis*/
method2(dynamic o) {
/*fields=[o,this],free=[o,this],hasThis*/
dynamic local() => o as T;
return local;
}
}
////////////////////////////////////////////////////////////////////////////////
/// Implicit as-cast is not required with --omit-implicit-checks.
////////////////////////////////////////////////////////////////////////////////
/*element: Class3.:hasThis*/
class Class3<T> {
/*element: Class3.method3:hasThis*/
method3(dynamic o) {
/*fields=[o],free=[o],hasThis*/
T local() => o;
return local;
}
}
main() {
new Class1<int>().method1(0).call();
new Class2<int>().method2(0).call();
new Class3<int>().method3(0).call();
}