[KLIB] Handle linkage error
Do not crash compiler with ugly stacktrace in case of misconfiguration. Report relatively friendly diagnostic message instead
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.linkage
|
||||
|
||||
object KotlinIrLinkerInternalException : Exception("Kotlin IR Linker exception")
|
||||
@@ -16,11 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
|
||||
import org.jetbrains.kotlin.ir.linkage.IrProvider
|
||||
import org.jetbrains.kotlin.ir.linkage.KotlinIrLinkerInternalException
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||
|
||||
@@ -38,6 +40,7 @@ class ExternalDependenciesGenerator(
|
||||
*/
|
||||
var unbound = setOf<IrSymbol>()
|
||||
lateinit var prevUnbound: Set<IrSymbol>
|
||||
try {
|
||||
do {
|
||||
prevUnbound = unbound
|
||||
unbound = symbolTable.allUnbound
|
||||
@@ -50,6 +53,9 @@ class ExternalDependenciesGenerator(
|
||||
}
|
||||
// We wait for the unbound to stabilize on fake overrides.
|
||||
} while (unbound != prevUnbound)
|
||||
} catch (ex: KotlinIrLinkerInternalException) {
|
||||
throw AnalysisResult.CompilationErrorException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user