aoqi@0: /* aoqi@0: * @test /nodynamiccopyright/ aoqi@0: * @bug 8003280 aoqi@0: * @summary Add lambda tests aoqi@0: * check that return type is inferred from target type when cyclic inference found aoqi@0: * @author Maurizio Cimadamore aoqi@0: * @compile/fail/ref=TargetType14.out -XDrawDiagnostics TargetType14.java aoqi@0: */ aoqi@0: aoqi@0: class TargetType14 { aoqi@0: aoqi@0: interface SAM { aoqi@0: X m(int i, int j); aoqi@0: } aoqi@0: aoqi@0: static void test() { aoqi@0: SAM s1 = (i, j) -> i + j; aoqi@0: m((i, j) -> i + j); aoqi@0: SAM s2 = m2((i, j) -> i + j); //ok aoqi@0: SAM s3 = m2((i, j) -> "" + i + j); //no aoqi@0: } aoqi@0: aoqi@0: static void m(SAM s) { } aoqi@0: static SAM m2(SAM s) { return null; } aoqi@0: }