Skip to content

Commit 720cf56

Browse files
committed
Exclude enum constructor invocations from defaults handling
These seem to provide null arguments even though the constructor doesn't provide defaults, presumably for completion by a later compiler phase.
1 parent 6cc74da commit 720cf56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,9 @@ open class KotlinFileExtractor(
29382938
}
29392939
val locId = tw.getLocation(e)
29402940
val valueArgs = (0 until e.valueArgumentsCount).map { e.getValueArgument(it) }
2941-
val anyDefaultArgs = valueArgs.any { it == null }
2941+
// For now, don't try to use default methods for enum constructor calls,
2942+
// which have null arguments even though the parameters don't give default values.
2943+
val anyDefaultArgs = e !is IrEnumConstructorCall && valueArgs.any { it == null }
29422944
val id = if (anyDefaultArgs) {
29432945
extractNewExpr(getDefaultsMethodLabel(e.symbol.owner).cast(), type, locId, parent, idx, callable, enclosingStmt).also {
29442946
extractDefaultsCallArguments(it, e.symbol.owner, callable, enclosingStmt, valueArgs, null, null)

0 commit comments

Comments
 (0)