-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kapt+JVM_IR: generate delegated members correctly
Generate a declaration for each delegated member without body. If we don't generate delegated declarations, subclasses will have incorrect IR with unbound symbols in fake overrides. #KT-58027 Fixed (cherry picked from commit bc7aea1)
- Loading branch information
Showing
7 changed files
with
125 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
plugins/kapt3/kapt3-compiler/testData/converter/delegationAndCompanionObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// CORRECT_ERROR_TYPES | ||
|
||
@Suppress("UNRESOLVED_REFERENCE") | ||
interface A { | ||
fun inject(b: B) | ||
val x: String | ||
|
||
companion object : B() | ||
|
||
abstract class B : A by Unresolved | ||
} |
39 changes: 39 additions & 0 deletions
39
plugins/kapt3/kapt3-compiler/testData/converter/delegationAndCompanionObject.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@kotlin.Metadata() | ||
@kotlin.Suppress(names = {"UNRESOLVED_REFERENCE"}) | ||
public abstract interface A { | ||
@org.jetbrains.annotations.NotNull() | ||
public static final A.Companion Companion = null; | ||
|
||
public abstract void inject(@org.jetbrains.annotations.NotNull() | ||
A.B b); | ||
|
||
@org.jetbrains.annotations.NotNull() | ||
public abstract java.lang.String getX(); | ||
|
||
@kotlin.Metadata() | ||
public static abstract class B implements A { | ||
|
||
@java.lang.Override() | ||
public void inject(@org.jetbrains.annotations.NotNull() | ||
A.B b) { | ||
} | ||
|
||
@java.lang.Override() | ||
@org.jetbrains.annotations.NotNull() | ||
public java.lang.String getX() { | ||
return null; | ||
} | ||
|
||
public B() { | ||
super(); | ||
} | ||
} | ||
|
||
@kotlin.Metadata() | ||
public static final class Companion extends A.B { | ||
|
||
private Companion() { | ||
super(); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
plugins/kapt3/kapt3-compiler/testData/converter/delegationAndCompanionObject_ir.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@kotlin.Metadata() | ||
@kotlin.Suppress(names = {"UNRESOLVED_REFERENCE"}) | ||
public abstract interface A { | ||
@org.jetbrains.annotations.NotNull() | ||
public static final A.Companion Companion = null; | ||
|
||
public abstract void inject(@org.jetbrains.annotations.NotNull() | ||
A.B b); | ||
|
||
@org.jetbrains.annotations.NotNull() | ||
public abstract java.lang.String getX(); | ||
|
||
@kotlin.Metadata() | ||
public static abstract class B implements A { | ||
|
||
public B() { | ||
super(); | ||
} | ||
|
||
@java.lang.Override() | ||
@org.jetbrains.annotations.NotNull() | ||
public java.lang.String getX() { | ||
return null; | ||
} | ||
|
||
@java.lang.Override() | ||
public void inject(@org.jetbrains.annotations.NotNull() | ||
A.B b) { | ||
} | ||
} | ||
|
||
@kotlin.Metadata() | ||
public static final class Companion extends A.B { | ||
|
||
private Companion() { | ||
super(); | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
.../org/jetbrains/kotlin/kapt3/test/runners/ClassFileToSourceStubConverterTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...rg/jetbrains/kotlin/kapt3/test/runners/IrClassFileToSourceStubConverterTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.