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

Skip to content

Commit e5cd32b

Browse files
committed
Kotlin: Get the tests passing again
1 parent ceb1e57 commit e5cd32b

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,15 +1654,20 @@ open class KotlinFileExtractor(
16541654
// field that we are accessing here.
16551655
val exprParent = parent.expr(e, callable)
16561656
val c: IrClass = e.symbol.owner
1657-
val instance = useObjectClassInstance(c)
1657+
// TODO: If this is enabled for Unit then it currently makes tests fail
1658+
if(c.name.asString() == "Unit") {
1659+
logger.warnElement(Severity.ErrorSevere, "Unit object not handled yet", e)
1660+
} else {
1661+
val instance = useObjectClassInstance(c)
16581662

1659-
val id = tw.getFreshIdLabel<DbVaraccess>()
1660-
val type = useType(e.type)
1661-
val locId = tw.getLocation(e)
1662-
tw.writeExprs_varaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
1663-
tw.writeHasLocation(id, locId)
1663+
val id = tw.getFreshIdLabel<DbVaraccess>()
1664+
val type = useType(e.type)
1665+
val locId = tw.getLocation(e)
1666+
tw.writeExprs_varaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
1667+
tw.writeHasLocation(id, locId)
16641668

1665-
tw.writeVariableBinding(id, instance.id)
1669+
tw.writeVariableBinding(id, instance.id)
1670+
}
16661671
}
16671672
else -> {
16681673
logger.warnElement(Severity.ErrorSevere, "Unrecognised IrExpression: " + e.javaClass, e)

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@
421421
| file://:0:0:0:0 | BinaryOperator | Interface, ParameterizedType |
422422
| file://:0:0:0:0 | Boolean | Class |
423423
| file://:0:0:0:0 | Boolean | Class |
424+
| file://:0:0:0:0 | BooleanCompanionObject | Class |
424425
| file://:0:0:0:0 | BooleanSignature | Class |
425426
| file://:0:0:0:0 | BottomSignature | Class |
426427
| file://:0:0:0:0 | BoundMethodHandle | Class |
@@ -577,6 +578,7 @@
577578
| file://:0:0:0:0 | Char | Class |
578579
| file://:0:0:0:0 | CharArray | Class |
579580
| file://:0:0:0:0 | CharBuffer | Class |
581+
| file://:0:0:0:0 | CharCompanionObject | Class |
580582
| file://:0:0:0:0 | CharIterator | Class |
581583
| file://:0:0:0:0 | CharProgression | Class |
582584
| file://:0:0:0:0 | CharRange | Class |
@@ -1118,6 +1120,7 @@
11181120
| file://:0:0:0:0 | DoubleArray | Class |
11191121
| file://:0:0:0:0 | DoubleBinaryOperator | Interface |
11201122
| file://:0:0:0:0 | DoubleBuffer | Class |
1123+
| file://:0:0:0:0 | DoubleCompanionObject | Class |
11211124
| file://:0:0:0:0 | DoubleConsumer | Interface |
11221125
| file://:0:0:0:0 | DoubleFunction | GenericType, Interface, ParameterizedType |
11231126
| file://:0:0:0:0 | DoubleFunction | Interface, ParameterizedType |
@@ -1291,6 +1294,7 @@
12911294
| file://:0:0:0:0 | Enum | Class, ParameterizedType |
12921295
| file://:0:0:0:0 | Enum | Class, ParameterizedType |
12931296
| file://:0:0:0:0 | Enum | Class, ParameterizedType |
1297+
| file://:0:0:0:0 | EnumCompanionObject | Class |
12941298
| file://:0:0:0:0 | EnumSet | Class, GenericType, ParameterizedType |
12951299
| file://:0:0:0:0 | EnumSet | Class, ParameterizedType |
12961300
| file://:0:0:0:0 | EnumSet | Class, ParameterizedType |
@@ -1612,6 +1616,7 @@
16121616
| file://:0:0:0:0 | IntArray | Class |
16131617
| file://:0:0:0:0 | IntBinaryOperator | Interface |
16141618
| file://:0:0:0:0 | IntBuffer | Class |
1619+
| file://:0:0:0:0 | IntCompanionObject | Class |
16151620
| file://:0:0:0:0 | IntConsumer | Interface |
16161621
| file://:0:0:0:0 | IntFunction | GenericType, Interface, ParameterizedType |
16171622
| file://:0:0:0:0 | IntFunction | Interface, ParameterizedType |
@@ -1916,6 +1921,7 @@
19161921
| file://:0:0:0:0 | LongArray | Class |
19171922
| file://:0:0:0:0 | LongBinaryOperator | Interface |
19181923
| file://:0:0:0:0 | LongBuffer | Class |
1924+
| file://:0:0:0:0 | LongCompanionObject | Class |
19191925
| file://:0:0:0:0 | LongConsumer | Interface |
19201926
| file://:0:0:0:0 | LongFunction | GenericType, Interface, ParameterizedType |
19211927
| file://:0:0:0:0 | LongFunction | Interface, ParameterizedType |
@@ -2541,6 +2547,7 @@
25412547
| file://:0:0:0:0 | String | Class |
25422548
| file://:0:0:0:0 | StringBuffer | Class |
25432549
| file://:0:0:0:0 | StringBuilder | Class |
2550+
| file://:0:0:0:0 | StringCompanionObject | Class |
25442551
| file://:0:0:0:0 | Subject | Class |
25452552
| file://:0:0:0:0 | Subset | Class |
25462553
| file://:0:0:0:0 | SuppliedThreadLocal | Class, GenericType, ParameterizedType |

0 commit comments

Comments
 (0)