java inference: stop when argument has no associated formal parameter

GitOrigin-RevId: cbc4e435f6e03bd06eac4dcf21196bdd61dc6c3d
This commit is contained in:
Anna.Kozlova
2019-12-03 16:00:47 +01:00
committed by intellij-monorepo-bot
parent d93efc10e8
commit 21e434894f
3 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
import java.util.function.UnaryOperator;
import java.util.stream.Stream;
class Main {
static class A {
A next(){return null;}
int x;
}
static boolean isGood(A a) {
return true;
}
{
Stream.iterate(new A(), (UnaryOperator<A>) <error descr="Bad return type in method reference: cannot convert boolean to Main.A">Main::isGood</error>, a -> a.<error descr="Cannot resolve method 'next()'">next</error>()).filter(a -> a.x < 3).forEach(System.out::println);
}
}