-
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.
Value classes: Support @JvmName annotation on functions with inline
classes in signatures, but not on methods of inline classes.
- Loading branch information
Showing
6 changed files
with
79 additions
and
8 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
29 changes: 29 additions & 0 deletions
29
compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.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,29 @@ | ||
// !LANGUAGE: +InlineClasses | ||
// WITH_RUNTIME | ||
|
||
inline class Foo(val a: Any) | ||
|
||
@JvmName("bar") | ||
fun bar(f: Foo) {} | ||
|
||
@JvmName("baz") | ||
fun baz(r: Result<Int>) {} | ||
|
||
@JvmName("test") | ||
fun returnsInlineClass() = Foo(1) | ||
|
||
@JvmName("test") | ||
@Suppress("RESULT_CLASS_IN_RETURN_TYPE") | ||
fun returnsKotlinResult(a: Result<Int>): Result<Int> = a | ||
|
||
class C { | ||
@JvmName("test") | ||
fun returnsInlineClass() = Foo(1) | ||
|
||
@JvmName("test") | ||
@Suppress("RESULT_CLASS_IN_RETURN_TYPE") | ||
fun returnsKotlinResult(a: Result<Int>): Result<Int> = a | ||
} | ||
|
||
@JvmName("extensionFun") | ||
fun Foo.extensionFun() {} |
35 changes: 35 additions & 0 deletions
35
compiler/testData/codegen/bytecodeListing/inlineClasses/jvmName.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,35 @@ | ||
@kotlin.Metadata | ||
public final class C { | ||
// source: 'jvmName.kt' | ||
public method <init>(): void | ||
public final @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(): java.lang.Object | ||
public final @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object | ||
} | ||
|
||
@kotlin.Metadata | ||
public final class Foo { | ||
// source: 'jvmName.kt' | ||
private final @org.jetbrains.annotations.NotNull field a: java.lang.Object | ||
private synthetic method <init>(p0: java.lang.Object): void | ||
public synthetic final static method box-impl(p0: java.lang.Object): Foo | ||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object | ||
public method equals(p0: java.lang.Object): boolean | ||
public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean | ||
public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean | ||
public final @org.jetbrains.annotations.NotNull method getA(): java.lang.Object | ||
public method hashCode(): int | ||
public static method hashCode-impl(p0: java.lang.Object): int | ||
public method toString(): java.lang.String | ||
public static method toString-impl(p0: java.lang.Object): java.lang.String | ||
public synthetic final method unbox-impl(): java.lang.Object | ||
} | ||
|
||
@kotlin.Metadata | ||
public final class JvmNameKt { | ||
// source: 'jvmName.kt' | ||
public final static @kotlin.jvm.JvmName method bar(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void | ||
public final static @kotlin.jvm.JvmName method baz(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void | ||
public final static @kotlin.jvm.JvmName method extensionFun(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void | ||
public final static @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(): java.lang.Object | ||
public final static @kotlin.jvm.JvmName @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object | ||
} |
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
5 changes: 5 additions & 0 deletions
5
compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.