KT-1156 Throwing exception on the right side of elvis operator marks code unreachable
This commit is contained in:
@@ -275,6 +275,17 @@ public class JetControlFlowProcessor {
|
||||
builder.unsupported(expression); // TODO
|
||||
}
|
||||
}
|
||||
else if (operationType == JetTokens.ELVIS) {
|
||||
builder.read(expression);
|
||||
value(expression.getLeft(), false);
|
||||
value(expression.getOperationReference(), false);
|
||||
Label afterElvis = builder.createUnboundLabel();
|
||||
builder.jumpOnTrue(afterElvis);
|
||||
if (right != null) {
|
||||
value(right, false);
|
||||
}
|
||||
builder.bindLabel(afterElvis);
|
||||
}
|
||||
else {
|
||||
value(expression.getLeft(), false);
|
||||
if (right != null) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//KT-1156 Throwing exception on the right side of elvis operator marks code unreachable
|
||||
|
||||
//+JDK
|
||||
|
||||
fun foo(maybe: Int?) {
|
||||
val i : Int = maybe ?: throw RuntimeException("No value")
|
||||
System.out?.println(i)
|
||||
}
|
||||
Reference in New Issue
Block a user