FIR: add a test with current top resolve problems

This commit is contained in:
Mikhail Glukhikh
2019-09-17 16:01:11 +03:00
parent 40dd229021
commit 0438ab96e1
3 changed files with 113 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
class Interner<T> {
private fun find(obj: T): Int? = null
fun intern(obj: T) = find(obj)
}
class Externer {
private fun find(obj: Int): Int? = null
fun intern(obj: Int) = find(obj)
}
interface Some {
data class WithPrimary(val x: Int, val arr: Array<String>? = null, val s: String? = null)
}
fun test() {
Some.WithPrimary(42, arrayOf("alpha", "omega"))
}
class KonanTarget(val name: String)
val KonanTarget.presetName
get() = this.name
// Own private property conflicts with synthetic property from Java supertype
// Exhaustive when expressions give Any result type
// Substitution for field declared in Java super-type does not work (KotlinStringLiteralTextEscaper.myHost)
// Super is not resolved in anonymous object
// TypeParameterDescriptor.name is not resolved
+78
View File
@@ -0,0 +1,78 @@
FILE: problems2.kt
public final class Interner<T> : R|kotlin/Any| {
public constructor<T>(): R|Interner<T>| {
super<R|kotlin/Any|>()
}
private final fun find(obj: R|T|): R|kotlin/Int?| {
^find Null(null)
}
public final fun intern(obj: R|T|): <ERROR TYPE REF: Inapplicable(HIDDEN): [/Interner.find]> {
^intern <Inapplicable(HIDDEN): [/Interner.find]>#(R|<local>/obj|)
}
}
public final class Externer : R|kotlin/Any| {
public constructor(): R|Externer| {
super<R|kotlin/Any|>()
}
private final fun find(obj: R|kotlin/Int|): R|kotlin/Int?| {
^find Null(null)
}
public final fun intern(obj: R|kotlin/Int|): R|kotlin/Int?| {
^intern this@R|/Externer|.R|/Externer.find|(R|<local>/obj|)
}
}
public abstract interface Some : R|kotlin/Any| {
public final data class WithPrimary : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|, arr: R|kotlin/Array<kotlin/String>?| = Null(null), s: R|kotlin/String?| = Null(null)): R|Some.WithPrimary| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
public final val arr: R|kotlin/Array<kotlin/String>?| = R|<local>/arr|
public get(): R|kotlin/Array<kotlin/String>?|
public final val s: R|kotlin/String?| = R|<local>/s|
public get(): R|kotlin/String?|
public final fun component1(): R|kotlin/Int| {
^component1 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.x|
}
public final fun component2(): R|kotlin/Array<kotlin/String>?| {
^component2 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.arr|
}
public final fun component3(): R|kotlin/String?| {
^component3 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.s|
}
public final fun copy(x: R|kotlin/Int| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.x|, arr: R|kotlin/Array<kotlin/String>?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.arr|, s: R|kotlin/String?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.s|): R|Some.WithPrimary| {
}
}
}
public final fun test(): R|kotlin/Unit| {
Q|Some|.<Unresolved name: WithPrimary>#(Int(42), R?C|kotlin/arrayOf|(String(alpha), String(omega)))
}
public final class KonanTarget : R|kotlin/Any| {
public constructor(name: R|kotlin/String|): R|KonanTarget| {
super<R|kotlin/Any|>()
}
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
}
public final val R|KonanTarget|.presetName: <ERROR TYPE REF: Unresolved name: name>
public get(): <ERROR TYPE REF: Unresolved name: name> {
^ this#.<Unresolved name: name>#
}
@@ -129,6 +129,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
runTest("compiler/fir/resolve/testData/resolve/NestedSuperType.kt");
}
@TestMetadata("problems2.kt")
public void testProblems2() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems2.kt");
}
@TestMetadata("recursiveCallOnWhenWithSealedClass.kt")
public void testRecursiveCallOnWhenWithSealedClass() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.kt");