forked from JavaTX/JavaCompilerCore
17 lines
461 B
Java
17 lines
461 B
Java
import java.lang.Integer;
|
|
import java.lang.Object;
|
|
import java.lang.Float;
|
|
|
|
record Rec(Integer a, Object b) {}
|
|
|
|
public class Switch {
|
|
main(o) {
|
|
return switch (o) {
|
|
case Rec(Integer a, Integer b) -> { yield a + b; }
|
|
case Rec(Integer a, Float b) -> { yield a + 10; }
|
|
case Rec(Integer a, Rec(Integer b, Integer c)) -> { yield a + b + c; }
|
|
case Integer i -> { yield i; }
|
|
default -> { yield 0; }
|
|
};
|
|
}
|
|
} |