KAPT: Fix error types for receivers and property setters in stubs

When using correct error types and there is a property setter or
receiver for an unknown type then the parameter type would be `Object` instead
of the error type.

This fixes KT-46965 and KT-46966
This commit is contained in:
Nicklas Ansman Giertz
2022-09-16 17:06:35 -04:00
committed by Alexander Udalov
parent dd051c1556
commit 3c69a0493e
5 changed files with 182 additions and 29 deletions
@@ -0,0 +1,20 @@
// CORRECT_ERROR_TYPES
@Suppress("UNRESOLVED_REFERENCE")
class TypeHook {
var customProperty: UnknownType
get() = UnknownType()
set(value) {}
var UnknownType.receiverProperty: UnknownType
get() = UnknownType()
set(value) {}
fun UnknownType.receiverFunction(): UnknownType = UnknownType()
companion object {
var UnknownType.extensionProperty: UnknownType
get() = UnknownType()
set(value) {}
}
}
@@ -0,0 +1,57 @@
import java.lang.System;
@kotlin.Metadata()
@kotlin.Suppress(names = {"UNRESOLVED_REFERENCE"})
public final class TypeHook {
@org.jetbrains.annotations.NotNull()
public static final TypeHook.Companion Companion = null;
public TypeHook() {
super();
}
@org.jetbrains.annotations.NotNull()
public final UnknownType getCustomProperty() {
return null;
}
public final void setCustomProperty(@org.jetbrains.annotations.NotNull()
UnknownType value) {
}
@org.jetbrains.annotations.NotNull()
public final UnknownType getReceiverProperty(@org.jetbrains.annotations.NotNull()
UnknownType $this$receiverProperty) {
return null;
}
public final void setReceiverProperty(@org.jetbrains.annotations.NotNull()
UnknownType $this$receiverProperty, @org.jetbrains.annotations.NotNull()
UnknownType value) {
}
@org.jetbrains.annotations.NotNull()
public final UnknownType receiverFunction(@org.jetbrains.annotations.NotNull()
UnknownType $this$receiverFunction) {
return null;
}
@kotlin.Metadata()
public static final class Companion {
private Companion() {
super();
}
@org.jetbrains.annotations.NotNull()
public final UnknownType getExtensionProperty(@org.jetbrains.annotations.NotNull()
UnknownType $this$extensionProperty) {
return null;
}
public final void setExtensionProperty(@org.jetbrains.annotations.NotNull()
UnknownType $this$extensionProperty, @org.jetbrains.annotations.NotNull()
UnknownType value) {
}
}
}