Use header->impl mapping in HeaderImplDeclarationChecker.areCompatibleTypes
Construct a special TypeCheckingContext that is aware of the magic behind the "impl typealias" that implements a "header class" #KT-16986 Fixed
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
header class Simple
|
||||
header fun createSimple(): Simple
|
||||
|
||||
header class Generic<A, B>
|
||||
header fun <A, B> createGeneric(a: A, b: B): Generic<A, B>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class SimpleImpl
|
||||
impl typealias Simple = SimpleImpl
|
||||
impl fun createSimple(): Simple = SimpleImpl()
|
||||
|
||||
class GenericImpl<A, B>
|
||||
impl typealias Generic<A, B> = GenericImpl<A, B>
|
||||
impl fun <A, B> createGeneric(a: A, b: B): Generic<A, B> = GenericImpl()
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
header fun stringBuilder(sb: StringBuilder)
|
||||
|
||||
header fun kotlinVersion(kv: KotlinVersion)
|
||||
|
||||
header fun regex(r: Regex)
|
||||
|
||||
header fun pair(p: Pair<String, List<Double>>)
|
||||
|
||||
header fun <A, B> genericPair(p: Pair<A, B>)
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
impl fun stringBuilder(sb: StringBuilder) {}
|
||||
|
||||
impl fun kotlinVersion(kv: KotlinVersion) {}
|
||||
|
||||
impl fun regex(r: Regex) {}
|
||||
|
||||
impl fun pair(p: Pair<String, List<Double>>) {}
|
||||
|
||||
impl fun <A, B> genericPair(p: Pair<A, B>) {}
|
||||
@@ -102,5 +102,17 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun testHeaderClassImplTypealias() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testHeaderFunUsesStdlibInSignature() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], withStdlibCommon = true, configureModule = { module, platform ->
|
||||
if (platform is TargetPlatformKind.Jvm) {
|
||||
module.addLibrary(ForTestCompileRuntime.runtimeJarForTests())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user