Support inline classes in MPP resolver/checker model
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects, +InlineClasses
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect inline class Foo1(val x: Int) {
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
expect inline class Foo2(val x: Int)
|
||||
|
||||
expect <!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, JVM:ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS!>inline<!> class Foo3
|
||||
|
||||
expect class NonInlineExpect
|
||||
|
||||
expect inline class NonInlineActual(val x: Int)
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual inline class Foo1(val x: Int) {
|
||||
actual fun bar(): String = "Hello"
|
||||
}
|
||||
actual inline class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo2<!>(val x: String)
|
||||
actual <!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS!>inline<!> class Foo3
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual inline<!> class NonInlineExpect(val x: Int)
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual<!> class NonInlineActual actual constructor(actual val x: Int)
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public final expect inline class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.Int)
|
||||
public expect final val x: kotlin.Int
|
||||
public final expect fun bar(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final expect inline class Foo2 {
|
||||
public constructor Foo2(/*0*/ x: kotlin.Int)
|
||||
public expect final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final expect inline class Foo3 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final expect inline class NonInlineActual {
|
||||
public constructor NonInlineActual(/*0*/ x: kotlin.Int)
|
||||
public expect final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final expect class NonInlineExpect {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public final actual inline class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public final actual fun bar(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final actual inline class Foo2 {
|
||||
public constructor Foo2(/*0*/ x: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final actual inline class Foo3 {
|
||||
public constructor Foo3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final actual class NonInlineActual {
|
||||
public constructor NonInlineActual(/*0*/ x: kotlin.Int)
|
||||
public actual final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final actual inline class NonInlineExpect {
|
||||
public constructor NonInlineExpect(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -24,31 +24,31 @@ The following declaration is incompatible because class kinds are different (cla
|
||||
actual class N3
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:5: error: actual class 'N2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public final expect class N2
|
||||
|
||||
actual inner class N2
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:5: error: actual class 'I2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public final expect inner class I2
|
||||
|
||||
actual class I2
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:5: error: actual companion object 'Companion' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public expect object Companion
|
||||
|
||||
actual companion object {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:5: error: actual object 'Factory' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public expect companion object Factory
|
||||
|
||||
actual object Factory
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:5: error: actual object 'Companion' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public expect companion object
|
||||
|
||||
actual object Companion
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@file:Suppress("UNSUPPORTED_FEATURE")
|
||||
|
||||
expect inline class Foo1(val x: Int)
|
||||
expect inline class Foo2(val y: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
@file:Suppress("UNSUPPORTED_FEATURE")
|
||||
|
||||
actual inline class Foo1(val x: Int)
|
||||
|
||||
actual class Foo2 actual constructor(actual val y: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
@file:Suppress("UNSUPPORTED_FEATURE")
|
||||
|
||||
actual inline class Foo1(val x: Int)
|
||||
|
||||
actual class Foo2 actual constructor(actual val y: String)
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/inlineClasses/jvm.kt:5:1: error: actual class 'Foo2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public final expect inline class Foo2
|
||||
|
||||
actual class Foo2 actual constructor(actual val y: String)
|
||||
^
|
||||
|
||||
-- JS --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/inlineClasses/js.kt:5:1: error: actual class 'Foo2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner, inline):
|
||||
public final expect inline class Foo2
|
||||
|
||||
actual class Foo2 actual constructor(actual val y: String)
|
||||
^
|
||||
Reference in New Issue
Block a user