summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/VoidValueCompatibilityOfImplicitlyTypedLambda.java
blob: 1188a9584dcab7a77bbb5eb19c1cdc17cc276a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
interface A {
  int m(int x);
}

interface B {
  void m(boolean x);
}

abstract class Test {
  abstract void foo(A j);
  abstract void foo(B i);

  void bar(Object o) {
    foo(x -> {
      return x += 1;
    });
    foo(x -> <error descr="Incompatible types. Found: 'int', required: '<lambda parameter>'">x += 1</error>);
    foo(x -> 1);
    foo(x -> <error descr="Operator '!' cannot be applied to 'int'">!x</error>);
    foo(x -> <error descr="Operator '++' cannot be applied to '<lambda parameter>'">++x</error>);
    foo(x -> o instanceof String ? 1 : 0);
  }
}