Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46e55f5

Browse files
committed
Kotlin: Add support for IMPLICIT_NOTNULL
1 parent d181b4b commit 46e55f5

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,16 @@ class X {
15071507
extractTypeAccess(e.typeOperand, id, 0, e)
15081508
extractExpressionExpr(e.argument, callable, id, 1)
15091509
}
1510+
IrTypeOperator.IMPLICIT_NOTNULL -> {
1511+
// TODO: Make this distinguishable from an explicit cast?
1512+
val id = tw.getFreshIdLabel<DbCastexpr>()
1513+
val locId = tw.getLocation(e)
1514+
val type = useType(e.type)
1515+
tw.writeExprs_castexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)
1516+
tw.writeHasLocation(id, locId)
1517+
extractTypeAccess(e.typeOperand, id, 0, e)
1518+
extractExpressionExpr(e.argument, callable, id, 1)
1519+
}
15101520
IrTypeOperator.INSTANCEOF -> {
15111521
val id = tw.getFreshIdLabel<DbInstanceofexpr>()
15121522
val locId = tw.getLocation(e)

java/ql/test/kotlin/library-tests/exprs/exprs.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@
101101
| exprs.kt:71:8:71:16 | ... != ... | NEExpr |
102102
| exprs.kt:71:13:71:16 | null | NullLiteral |
103103
| exprs.kt:72:9:72:29 | r2 | LocalVariableDeclExpr |
104+
| exprs.kt:72:29:72:29 | (...)... | CastExpr |
105+
| exprs.kt:72:29:72:29 | Rectangle | TypeAccess |
106+
| exprs.kt:72:29:72:29 | r | VarAccess |

0 commit comments

Comments
 (0)