KAPT: Fix an ISE when processing unresolved generic types

Error types that are generic could sometimes throw an ISE when
generating the stub.

This fixes KT-43786
This commit is contained in:
Nicklas Ansman Giertz
2022-09-16 11:54:52 -04:00
committed by Alexander Udalov
parent 21fe0e80ff
commit 115bc6ac89
6 changed files with 90 additions and 1 deletions
@@ -0,0 +1,14 @@
// CORRECT_ERROR_TYPES
@Suppress("UNRESOLVED_REFERENCE")
class Application {
lateinit var _preferencesDataStore: DataStore<Preferences>
companion object {
@JvmStatic
fun get(): Application = error()
@JvmStatic
fun getPreferencesDataStore() = get()._preferencesDataStore
}
}
@@ -0,0 +1,52 @@
@kotlin.Metadata()
@kotlin.Suppress(names = {"UNRESOLVED_REFERENCE"})
public final class Application {
public DataStore<Preferences> _preferencesDataStore;
@org.jetbrains.annotations.NotNull()
public static final Application.Companion Companion = null;
public Application() {
super();
}
@org.jetbrains.annotations.NotNull()
public final DataStore<Preferences> get_preferencesDataStore() {
return null;
}
public final void set_preferencesDataStore(@org.jetbrains.annotations.NotNull()
DataStore<Preferences> p0) {
}
@kotlin.jvm.JvmStatic()
@org.jetbrains.annotations.NotNull()
public static final Application get() {
return null;
}
@kotlin.jvm.JvmStatic()
@org.jetbrains.annotations.NotNull()
public static final java.lang.Object getPreferencesDataStore() {
return null;
}
@kotlin.Metadata()
public static final class Companion {
private Companion() {
super();
}
@kotlin.jvm.JvmStatic()
@org.jetbrains.annotations.NotNull()
public final Application get() {
return null;
}
@kotlin.jvm.JvmStatic()
@org.jetbrains.annotations.NotNull()
public final java.lang.Object getPreferencesDataStore() {
return null;
}
}
}
@@ -451,6 +451,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt34569.kt");
}
@Test
@TestMetadata("kt43786.kt")
public void testKt43786() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt43786.kt");
}
@Test
@TestMetadata("lazyProperty.kt")
public void testLazyProperty() throws Exception {
@@ -451,6 +451,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt34569.kt");
}
@Test
@TestMetadata("kt43786.kt")
public void testKt43786() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt43786.kt");
}
@Test
@TestMetadata("lazyProperty.kt")
public void testLazyProperty() throws Exception {