blob: 6167b32dc5bb399eefd20ee7a8d6b77b1fa6c239 [file] [log] [blame]
// Copyright (c) 2017, 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.
/*@testedFeatures=inference*/
library test;
void foo<E>(C<E> c, int cmp(E a, E b)) {}
class C<E> {
void barA([int cmp(E a, E b)]) {
/*@ typeArgs=C::E* */ foo(this, cmp /*@target=Object.==*/ ?? _default);
}
void barB([int cmp(E a, E b)]) {
/*@ typeArgs=C::E* */ foo(
this, cmp /*@target=Object.==*/ ?? (_default as int Function(E, E)));
}
void barC([int cmp(E a, E b)]) {
int Function(E, E) v = _default;
/*@ typeArgs=C::E* */ foo(this, cmp /*@target=Object.==*/ ?? v);
}
void barD([int cmp(E a, E b)]) {
foo<E>(this, cmp /*@target=Object.==*/ ?? _default);
}
void barE([int cmp(E a, E b)]) {
/*@ typeArgs=C::E* */ foo(
this, cmp /*@target=Object.==*/ == null ? _default : cmp);
}
void barF([int cmp(E a, E b)]) {
/*@ typeArgs=C::E* */ foo(
this, cmp /*@target=Object.==*/ != null ? cmp : _default);
}
static int _default(a, b) {
return /*@target=int.unary-*/ -1;
}
}
main() {}