switch expression type: initial

This commit is contained in:
Anna.Kozlova
2018-11-19 11:25:18 +01:00
parent 41b25091e7
commit c3bc7e3461
16 changed files with 332 additions and 14 deletions
@@ -0,0 +1,11 @@
class MyTest {
<T> T foo(T t) {
return t;
}
void m(int i) {
String s = foo(switch (i) {default -> "str";});
String s1 = <error descr="Incompatible types. Required String but 'foo' was inferred to T:
no instance(s) of type variable(s) exist so that Object conforms to String">foo(switch (i) {case 1 -> new Object(); default -> "str";});</error>
}
}