summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedLambdaExpressionsNoFormalParams.java
blob: 2d6254525d44cbb3e1414ddbd33c3724dddca62a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.util.function.Function;
import java.util.stream.IntStream;
import java.util.stream.Stream;

abstract class NoFormalParams {
  interface I<T> {
    T a(int a);
  }

  <F> I<F> foo(I<F> i) { return null;}

  {
    I<Integer> i =  foo(a -> foo(b -> 1)).a(0);
    foo(a -> foo(b -> 1)).a(0);
  }
}

abstract class NoFormalParamTypeInferenceNeeded {
  interface I<T> {
    T a(int a);
  }

  abstract <RR> RR  map(I<RR> mapper);
  abstract <R, V> R zip(Function<V, R> zipper);

  {
    map(a -> zip(text ->  text));
    zip(a -> zip(text ->  text));
    Integer zip = zip(<error descr="Cyclic inference">a -> zip(text -> text)</error>);
  }

}

class IDEA124983 {
  class Rectangle{
    public Rectangle(int i, int j, int h, int w) {
    }
  }

  void createGrid() {
    IntStream.range(0, 4)
      .mapToObj(i -> IntStream.range(0, 4).mapToObj(j -> {
        Rectangle rect2 = new Rectangle(i * 64, j * 64, 64, 64);
        return rect2;
      }))
      .flatMap(s -> s)
      .forEach(this::add);
  }

  void add(final Rectangle r) {}

  void simplified(final IntStream range) {
    range.mapToObj(i -> range.mapToObj(j -> 1)).flatMap(s -> s);
  }
}