Skip to content

Commit 1d3f482

Browse files
committed
Fix failing internal checkß
1 parent 145e209 commit 1d3f482

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,50 +3524,57 @@ open class KotlinFileExtractor(
35243524
}
35253525
is IrConst<*> -> {
35263526
val exprParent = parent.expr(e, callable)
3527-
when(val v = e.value) {
3528-
is Int, is Short, is Byte -> {
3529-
extractConstantInteger(v as Number, tw.getLocation(e), exprParent.parent, exprParent.idx, callable, exprParent.enclosingStmt)
3530-
} is Long -> {
3527+
val v = e.value
3528+
when {
3529+
v is Number && (v is Int || v is Short || v is Byte) -> {
3530+
extractConstantInteger(v, tw.getLocation(e), exprParent.parent, exprParent.idx, callable, exprParent.enclosingStmt)
3531+
}
3532+
v is Long -> {
35313533
val id = tw.getFreshIdLabel<DbLongliteral>()
35323534
val type = useType(e.type)
35333535
val locId = tw.getLocation(e)
35343536
tw.writeExprs_longliteral(id, type.javaResult.id, exprParent.parent, exprParent.idx)
35353537
tw.writeExprsKotlinType(id, type.kotlinResult.id)
35363538
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35373539
tw.writeNamestrings(v.toString(), v.toString(), id)
3538-
} is Float -> {
3540+
}
3541+
v is Float -> {
35393542
val id = tw.getFreshIdLabel<DbFloatingpointliteral>()
35403543
val type = useType(e.type)
35413544
val locId = tw.getLocation(e)
35423545
tw.writeExprs_floatingpointliteral(id, type.javaResult.id, exprParent.parent, exprParent.idx)
35433546
tw.writeExprsKotlinType(id, type.kotlinResult.id)
35443547
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35453548
tw.writeNamestrings(v.toString(), v.toString(), id)
3546-
} is Double -> {
3549+
}
3550+
v is Double -> {
35473551
val id = tw.getFreshIdLabel<DbDoubleliteral>()
35483552
val type = useType(e.type)
35493553
val locId = tw.getLocation(e)
35503554
tw.writeExprs_doubleliteral(id, type.javaResult.id, exprParent.parent, exprParent.idx)
35513555
tw.writeExprsKotlinType(id, type.kotlinResult.id)
35523556
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35533557
tw.writeNamestrings(v.toString(), v.toString(), id)
3554-
} is Boolean -> {
3558+
}
3559+
v is Boolean -> {
35553560
val id = tw.getFreshIdLabel<DbBooleanliteral>()
35563561
val type = useType(e.type)
35573562
val locId = tw.getLocation(e)
35583563
tw.writeExprs_booleanliteral(id, type.javaResult.id, exprParent.parent, exprParent.idx)
35593564
tw.writeExprsKotlinType(id, type.kotlinResult.id)
35603565
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35613566
tw.writeNamestrings(v.toString(), v.toString(), id)
3562-
} is Char -> {
3567+
}
3568+
v is Char -> {
35633569
val id = tw.getFreshIdLabel<DbCharacterliteral>()
35643570
val type = useType(e.type)
35653571
val locId = tw.getLocation(e)
35663572
tw.writeExprs_characterliteral(id, type.javaResult.id, exprParent.parent, exprParent.idx)
35673573
tw.writeExprsKotlinType(id, type.kotlinResult.id)
35683574
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35693575
tw.writeNamestrings(v.toString(), v.toString(), id)
3570-
} is String -> {
3576+
}
3577+
v is String -> {
35713578
val id = tw.getFreshIdLabel<DbStringliteral>()
35723579
val type = useType(e.type)
35733580
val locId = tw.getLocation(e)
@@ -3576,7 +3583,7 @@ open class KotlinFileExtractor(
35763583
extractExprContext(id, locId, callable, exprParent.enclosingStmt)
35773584
tw.writeNamestrings(v.toString(), v.toString(), id)
35783585
}
3579-
null -> {
3586+
v == null -> {
35803587
val id = tw.getFreshIdLabel<DbNullliteral>()
35813588
val type = useType(e.type) // class;kotlin.Nothing
35823589
val locId = tw.getLocation(e)

0 commit comments

Comments
 (0)