mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
lambda: infer from return type; cyclic inference stop
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
public class NotAFIT {
|
||||
static class First {
|
||||
static interface A<T> {
|
||||
void foo1();
|
||||
void foo2();
|
||||
}
|
||||
static <T> void foo(A<T> a) {
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(<error descr="Multiple non-overriding abstract methods found">() ->{}</error>);
|
||||
}
|
||||
}
|
||||
|
||||
static class WithInheritance {
|
||||
static interface A<T> {
|
||||
void foo1();
|
||||
}
|
||||
|
||||
static interface B<M> extends A<M> {
|
||||
void foo2();
|
||||
}
|
||||
|
||||
static <T> void foo(B<T> a) {
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(<error descr="Multiple non-overriding abstract methods found">()->{}</error>);
|
||||
}
|
||||
}
|
||||
|
||||
static class WithInheritanceOverrideSameMethod {
|
||||
static interface A<T> {
|
||||
void foo1();
|
||||
}
|
||||
|
||||
static interface B<M> extends A<M> {
|
||||
void foo1();
|
||||
}
|
||||
|
||||
static <T> void foo(B<T> a) {
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(()->{});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
class NoLambda {
|
||||
interface I<T> {
|
||||
void f(T t);
|
||||
}
|
||||
|
||||
<Z> void bar(I<Z> iz) {
|
||||
}
|
||||
|
||||
void bazz() {
|
||||
bar(null);
|
||||
bar(<error descr="Cyclic inference">(z)-> {System.out.println();}</error>);
|
||||
}
|
||||
|
||||
static <T> T id(T i2) {return i2;}
|
||||
|
||||
{
|
||||
id(<error descr="Cyclic inference">() -> {System.out.println("hi");}</error>);
|
||||
NoLambda.<Runnable>id(() -> {System.out.println("hi");});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user