Scripting: fix descriptor extraction, restore main-kts testing
Temporary solution for K1 - see comments in the code it seems that a scenario reproduced in the MainKtsTest.testKt48812 wasn't covered with analogous changes before. And it wasn't detected while main-kts tests weren't a part of the K1 scripting tests. The test is fixed now, and testing of main-kts is restored.
This commit is contained in:
committed by
Space Team
parent
776cdbcd3f
commit
3dc94f3d31
@@ -708,6 +708,7 @@ tasks {
|
||||
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
dependsOn(":kotlin-main-kts-test:test")
|
||||
}
|
||||
|
||||
register("scriptingK2Test") {
|
||||
|
||||
@@ -132,6 +132,7 @@ fun IrDeclaration.toIrBasedDescriptor(): DeclarationDescriptor = when (this) {
|
||||
is IrField -> toIrBasedDescriptor()
|
||||
is IrTypeAlias -> toIrBasedDescriptor()
|
||||
is IrErrorDeclaration -> toIrBasedDescriptor()
|
||||
is IrScript -> toIrBasedDescriptor()
|
||||
else -> error("Unknown declaration kind")
|
||||
}
|
||||
|
||||
@@ -1260,7 +1261,11 @@ private fun IrSimpleFunctionSymbol.toIrBasedDescriptorIfPossible(): FunctionDesc
|
||||
private fun IrPropertySymbol.toIrBasedDescriptorIfPossible(): PropertyDescriptor =
|
||||
if (isBound) owner.toIrBasedDescriptor() else descriptor
|
||||
|
||||
// this is a temporary solution for scripts - seems that introducing full-blown emulation of descriptors for the single degenerate case
|
||||
// doesn't make any sense.
|
||||
// this is a temporary solution for scripts
|
||||
// TODO: implement IR-based descriptors for scripts, see KT-60631
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
private fun IrScriptSymbol.toIrBasedDescriptorIfPossible(): ScriptDescriptor = descriptor
|
||||
|
||||
// see comment above to IrScriptSymbol.toIrBasedDescriptorIfPossible()
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
private fun IrScript.toIrBasedDescriptor() = descriptor
|
||||
|
||||
Reference in New Issue
Block a user