diff --git a/compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt b/compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt new file mode 100644 index 00000000000..89ff9b439b2 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +InlineClasses +// FILE: A.kt +package z + +interface IFoo { + fun foo(): String +} + +inline class Z(val s: String) : IFoo { + constructor(i: Int) : this(i.toString()) + + override fun foo(): String = s + + fun bar() = s + + inline fun run(lambda: (String) -> T) = lambda(s) + + companion object { + fun z(i: Int) = Z(i) + } +} + +// FILE: B.kt +import z.* + +fun test(z: Z) { + if (z.foo() != "1234") throw AssertionError() + if (z.bar() != "1234") throw AssertionError() + if (z.run { it } != "1234") throw AssertionError() + if (listOf(z)[0].s != "1234") throw AssertionError() +} + +fun box(): String { + test(Z("1234")) + test(Z(1234)) + test(Z.z(1234)) + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 78e689b49e1..a4e5a9d5c4c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -123,6 +123,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/enum.kt"); } + @TestMetadata("inlineClassFromBinaryDependencies.kt") + public void testInlineClassFromBinaryDependencies() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/inlineClassFromBinaryDependencies.kt"); + } + @TestMetadata("inlinedConstants.kt") public void testInlinedConstants() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt");