mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
switch expressions: inference for value breaks, correct lambda context in result expressions
This commit is contained in:
+8
@@ -23,5 +23,13 @@ no instance(s) of type variable(s) exist so that Object conforms to String">foo(
|
||||
default -> "str";
|
||||
});
|
||||
String s3 = foo(() -> switch (i) {default -> bar();});
|
||||
String s4 = foo(() -> switch (i) {default -> { break bar();}});
|
||||
String s5 = foo(<error descr="Incompatible types. Required String but 'foo' was inferred to T:
|
||||
no instance(s) of type variable(s) exist so that Integer conforms to String">() -> switch (i) {default -> { break 1;}}</error>);
|
||||
Supplier<String> stringSupplier = switch (i) {
|
||||
default -> {
|
||||
break () -> <error descr="Bad return type in lambda expression: int cannot be converted to String">1</error>;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user