Fix deserialization of inline functions from inline classes
This fixes:
CompileKotlinAgainstInlineKotlinTestGenerated$InlineClasses.testInlineFunctionInsideInlineClassesBox
Consider the following binary dependency:
inline class UInt(val u: Int) {
inline fun foo() {}
}
Now, if we want to inline function `foo`, we have to load it from bytes
as ASM method and to do this we should know the container of this function.
Note that because of inline class, actual signature of this function
would be `foo(I)` and it will be stored in UInt$Erased class, not `UInt`
This commit is contained in:
@@ -309,10 +309,21 @@ public class KotlinTypeMapper {
|
||||
ClassId classId = DescriptorUtilsKt.getClassId(classDescriptor);
|
||||
assert classId != null : "Deserialized class should have a ClassId: " + classDescriptor;
|
||||
|
||||
String nestedClass;
|
||||
if (isInterface(classDescriptor)) {
|
||||
nestedClass = JvmAbi.DEFAULT_IMPLS_SUFFIX;
|
||||
}
|
||||
else if (classDescriptor.isInline()) {
|
||||
nestedClass = JvmAbi.ERASED_INLINE_CLASS_SUFFIX;
|
||||
}
|
||||
else {
|
||||
nestedClass = null;
|
||||
}
|
||||
|
||||
if (nestedClass != null) {
|
||||
FqName relativeClassName = classId.getRelativeClassName();
|
||||
//TODO test nested trait fun inlining
|
||||
String defaultImplsClassName = relativeClassName.shortName().asString() + JvmAbi.DEFAULT_IMPLS_SUFFIX;
|
||||
String defaultImplsClassName = relativeClassName.shortName().asString() + nestedClass;
|
||||
return new ClassId(classId.getPackageFqName(), Name.identifier(defaultImplsClassName));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user