[FE 1.0] Correctly set USED_AS_EXPRESSION for unreachable when and if blocks
^KT-50028 Fixed
This commit is contained in:
committed by
teamcity
parent
7bcd3c7948
commit
df2e9e3797
@@ -0,0 +1,21 @@
|
||||
FILE fqName:<root> fileName:/kt50028.kt
|
||||
FUN name:test_1 visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>'
|
||||
WHEN type=kotlin.Nothing origin=WHEN
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>'
|
||||
CONST String type=kotlin.String value=""
|
||||
FUN name:test_2 visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:b index:0 type:kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test_2 (b: kotlin.Boolean): kotlin.Boolean declared in <root>'
|
||||
WHEN type=kotlin.Boolean origin=IF
|
||||
BRANCH
|
||||
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test_2' type=kotlin.Boolean origin=null
|
||||
then: CONST Boolean type=kotlin.Boolean value=true
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: THROW type=kotlin.Nothing
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (message: kotlin.String) [primary] declared in kotlin.NotImplementedError' type=kotlin.NotImplementedError origin=null
|
||||
@@ -0,0 +1,12 @@
|
||||
fun test_1(): String {
|
||||
return when {
|
||||
else -> return ""
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(b: Boolean): Boolean {
|
||||
return when {
|
||||
b -> true
|
||||
else -> throw NotImplementedError()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
FILE fqName:<root> fileName:/kt50028.kt
|
||||
FUN name:test_1 visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>'
|
||||
WHEN type=kotlin.String origin=WHEN
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: BLOCK type=kotlin.Nothing origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>'
|
||||
CONST String type=kotlin.String value=""
|
||||
FUN name:test_2 visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:b index:0 type:kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test_2 (b: kotlin.Boolean): kotlin.Boolean declared in <root>'
|
||||
WHEN type=kotlin.Boolean origin=IF
|
||||
BRANCH
|
||||
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test_2' type=kotlin.Boolean origin=null
|
||||
then: BLOCK type=kotlin.Boolean origin=null
|
||||
CONST Boolean type=kotlin.Boolean value=true
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: BLOCK type=kotlin.Nothing origin=null
|
||||
THROW type=kotlin.Nothing
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (message: kotlin.String) [primary] declared in kotlin.NotImplementedError' type=kotlin.NotImplementedError origin=null
|
||||
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-50028
|
||||
|
||||
fun test_1(): String {
|
||||
return when {
|
||||
else -> {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(b: Boolean): Boolean {
|
||||
return if (b) {
|
||||
true
|
||||
} else {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fun test_1(): String {
|
||||
return when {
|
||||
else -> { // BLOCK
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(b: Boolean): Boolean {
|
||||
return when {
|
||||
b -> { // BLOCK
|
||||
true
|
||||
}
|
||||
else -> { // BLOCK
|
||||
throw NotImplementedError()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user