Skip to content

Commit b5d6258

Browse files
authored
Merge pull request #9809 from igfoo/igfoo/fakeLabel
Kotlin: Remove the last uses of fakeLabel
2 parents 20febb6 + 83edb3b commit b5d6258

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,19 @@ open class KotlinUsesExtractor(
121121
}
122122
}
123123

124-
private fun extractErrorType(): TypeResults {
124+
private fun extractJavaErrorType(): TypeResult<DbErrortype> {
125125
val typeId = tw.getLabelFor<DbErrortype>("@\"errorType\"") {
126126
tw.writeError_type(it)
127127
}
128+
return TypeResult(typeId, null, "<CodeQL error type>")
129+
}
130+
131+
private fun extractErrorType(): TypeResults {
132+
val javaResult = extractJavaErrorType()
128133
val kotlinTypeId = tw.getLabelFor<DbKt_nullable_type>("@\"errorKotlinType\"") {
129-
tw.writeKt_nullable_types(it, typeId)
134+
tw.writeKt_nullable_types(it, javaResult.id)
130135
}
131-
return TypeResults(TypeResult(typeId, null, "<CodeQL error type>"),
136+
return TypeResults(javaResult,
132137
TypeResult(kotlinTypeId, null, "<CodeQL error type>"))
133138
}
134139

@@ -719,7 +724,7 @@ open class KotlinUsesExtractor(
719724
}
720725
else -> {
721726
logger.error("Unrecognised IrSimpleType: " + s.javaClass + ": " + s.render())
722-
return TypeResults(TypeResult(fakeLabel(), "unknown", "unknown"), TypeResult(fakeLabel(), "unknown", "unknown"))
727+
return extractErrorType()
723728
}
724729
}
725730
}
@@ -1276,7 +1281,7 @@ open class KotlinUsesExtractor(
12761281
}
12771282
else -> {
12781283
logger.error("Unexpected type argument.")
1279-
return TypeResult(fakeLabel(), "unknown", "unknown")
1284+
return extractJavaErrorType()
12801285
}
12811286
}
12821287
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,3 @@ class IntLabel<T>(val i: Int): Label<T> {
2929
class StringLabel<T>(val name: String): Label<T> {
3030
override fun toString(): String = "#$name"
3131
}
32-
33-
// TODO: Remove this and all of its uses
34-
fun <T> fakeLabel(): Label<T> {
35-
if (false) {
36-
println("Fake label")
37-
} else {
38-
val sw = StringWriter()
39-
Exception().printStackTrace(PrintWriter(sw))
40-
println("Fake label from:\n$sw")
41-
}
42-
return IntLabel(0)
43-
}

0 commit comments

Comments
 (0)