'SuspendFunction$n' should not be visible in member scopes (should be unresolved).
'SuspendFunction$n' class descriptors are created on demand by KotlinBuiltIns (and cached). On serialization, types constructed with 'SuspendFunction$n' are written as 'Function$n' with extra flag (SUSPEND_TYPE). On deserialization, corresponding 'SuspendFunction$n' classes are used.
This commit is contained in:
committed by
Stanislav Erokhin
parent
a70ac0160d
commit
80bd916f5d
+1
-2
@@ -127,9 +127,8 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
if (!type.hasClassName() && !type.hasTypeAliasName()) return emptySet()
|
||||
|
||||
val result = hashSetOf<KtModifierKeywordToken>()
|
||||
val classId = c.nameResolver.getClassId(if (type.hasClassName()) type.className else type.typeAliasName)
|
||||
|
||||
if (classId.asSingleFqName().toUnsafe().getFunctionalClassKind() == FunctionClassDescriptor.Kind.SuspendFunction) {
|
||||
if (Flags.SUSPEND_TYPE.get(type.flags)) {
|
||||
result.add(KtTokens.SUSPEND_KEYWORD)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// IntelliJ API Decompiler stub source generated from a class file
|
||||
// Implementation of methods is not available
|
||||
|
||||
package test
|
||||
|
||||
public final class TypeModifiers public constructor() {
|
||||
public final val function: () -> kotlin.Unit /* compiled code */
|
||||
|
||||
public final val functionOnSuspendFunction: (suspend () -> kotlin.Unit).() -> kotlin.Unit /* compiled code */
|
||||
|
||||
public final val suspendExtFunction: suspend kotlin.Any.() -> kotlin.Unit /* compiled code */
|
||||
|
||||
public final val suspendFunction: suspend () -> kotlin.Unit /* compiled code */
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class TypeModifiers {
|
||||
val function: () -> Unit = null!!
|
||||
|
||||
val suspendFunction: suspend () -> Unit = null!!
|
||||
|
||||
val suspendExtFunction: suspend Any.() -> Unit = null!!
|
||||
|
||||
val functionOnSuspendFunction: (suspend () -> Unit).() -> Unit = null!!
|
||||
}
|
||||
+6
@@ -150,4 +150,10 @@ public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCom
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeModifiers")
|
||||
public void testTypeModifiers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/TypeModifiers/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -156,4 +156,10 @@ public class CommonDecompiledTextTestGenerated extends AbstractCommonDecompiledT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeModifiers")
|
||||
public void testTypeModifiers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/TypeModifiers/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3038,6 +3038,12 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SuspendFunction.kt")
|
||||
public void testSuspendFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/SuspendFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Unit.kt")
|
||||
public void testUnit() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/Unit.kt");
|
||||
|
||||
Reference in New Issue
Block a user