diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt index f665868c591..e5f359b8c34 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt @@ -340,4 +340,9 @@ public fun PsiElement.siblings(forward: Boolean = true, withItself: Boolean = tr val stepFun = if (forward) { (e: PsiElement) -> e.getNextSibling() } else { (e: PsiElement) -> e.getPrevSibling() } val stream = stream(this, stepFun) return if (withItself) stream else stream.drop(1) +} + +public fun PsiElement.parents(withItself: Boolean = true): Stream { + val stream = stream(this) { if (it is PsiFile) null else it.getParent() } + return if (withItself) stream else stream.drop(1) } \ No newline at end of file diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index d7af63ee5fe..ad24de54345 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -119,6 +119,7 @@ import org.jetbrains.jet.lang.resolve.java.AbstractJavaTypeSubstitutorTest import org.jetbrains.jet.plugin.intentions.declarations.AbstractJoinLinesTest import org.jetbrains.jet.codegen.AbstractScriptCodegenTest import org.jetbrains.jet.plugin.parameterInfo.AbstractFunctionParameterInfoTest +import org.jetbrains.jet.psi.patternMatching.AbstractJetPsiUnifierTest fun main(args: Array) { System.setProperty("java.awt.headless", "true") @@ -309,6 +310,10 @@ fun main(args: Array) { model("checker/infos", testMethod = "doTestWithInfos") } + testClass(javaClass()) { + model("unifier") + } + testClass(javaClass()) { model("checker/codeFragments", extension = "kt", recursive = false) model("checker/codeFragments/imports", testMethod = "doTestWithImport", extension = "kt") diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt b/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt new file mode 100644 index 00000000000..aee80a113af --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +fun foo() { + when { + true -> { + val a = object: Function0 { + override fun invoke(): Int = 1 + } + val b = object: Function0 { + override fun invoke(): Int = a() + 1 + } + println(a() - b()) + } + + true -> { + val b = object: Function0 { + override fun invoke(): Int = 1 + } + val a = object: Function0 { + override fun invoke(): Int = b() + 1 + } + println(b() - a()) + } + + true -> { + val b = object: Function0 { + override fun invoke(): Int = 1 + } + val a = object: Function0 { + override fun invoke(): Int = b() + 1 + } + println(a() - b()) + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt.match b/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt.match new file mode 100644 index 00000000000..078ca0bc161 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt.match @@ -0,0 +1,19 @@ +{ + val a = object: Function0 { + override fun invoke(): Int = 1 + } + val b = object: Function0 { + override fun invoke(): Int = a() + 1 + } + println(a() - b()) + } + +{ + val b = object: Function0 { + override fun invoke(): Int = 1 + } + val a = object: Function0 { + override fun invoke(): Int = b() + 1 + } + println(b() - a()) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt b/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt new file mode 100644 index 00000000000..398af0d280f --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME +fun foo() { + when { + true -> { + fun a() = 1 + fun b() = a() + 1 + println(a() - b()) + } + + true -> { + fun b() = 1 + fun a() = b() + 1 + println(b() - a()) + } + + true -> { + fun b() = 1 + fun a() = b() + 1 + println(a() - b()) + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt.match b/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt.match new file mode 100644 index 00000000000..41fa07ce1f0 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt.match @@ -0,0 +1,11 @@ +{ + fun a() = 1 + fun b() = a() + 1 + println(a() - b()) + } + +{ + fun b() = 1 + fun a() = b() + 1 + println(b() - a()) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt b/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt new file mode 100644 index 00000000000..81ab1081987 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME +fun foo() { + when { + true -> { + val a = 1 + val b = a + 1 + println(a - b) + } + + true -> { + val b = 1 + val a = b + 1 + println(b - a) + } + + true -> { + val b = 1 + val a = b + 1 + println(a - b) + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt.match b/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt.match new file mode 100644 index 00000000000..a169aa7ca70 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt.match @@ -0,0 +1,11 @@ +{ + val a = 1 + val b = a + 1 + println(a - b) + } + +{ + val b = 1 + val a = b + 1 + println(b - a) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/break.kt b/idea/testData/unifier/equivalence/controlStructures/break.kt new file mode 100644 index 00000000000..af795f938b1 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/break.kt @@ -0,0 +1,16 @@ +fun foo(a: Int) { + @A + while (true) { + @B + while (true) { + if (a > 0) break@A + if (a < 0) break@B + } + + @B + while (true) { + if (a > 0) break@A + if (a < 0) break@B + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/break.kt.match b/idea/testData/unifier/equivalence/controlStructures/break.kt.match new file mode 100644 index 00000000000..e0b0ceeabc0 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/break.kt.match @@ -0,0 +1 @@ +break@B \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/continue.kt b/idea/testData/unifier/equivalence/controlStructures/continue.kt new file mode 100644 index 00000000000..dc1a5f53ae6 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/continue.kt @@ -0,0 +1,16 @@ +fun foo(a: Int) { + @A + while (true) { + @B + while (true) { + if (a > 0) continue@A + if (a < 0) continue@B + } + + @B + while (true) { + if (a > 0) continue@A + if (a < 0) continue@B + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/continue.kt.match b/idea/testData/unifier/equivalence/controlStructures/continue.kt.match new file mode 100644 index 00000000000..b5267f35b66 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/continue.kt.match @@ -0,0 +1,3 @@ +continue@A + +continue@A \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/doWhile.kt b/idea/testData/unifier/equivalence/controlStructures/doWhile.kt new file mode 100644 index 00000000000..239a99293cd --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/doWhile.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + var t = a + do { + println((t)) + t++ + } while (t != (a + b)) + + var u = a + do { + println(t) + t++ + } while (u != a + b) + + while (t != a + b) { + println(t) + t++ + } + + do { + println(t) + t++ + } while (t != a + b) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/doWhile.kt.match b/idea/testData/unifier/equivalence/controlStructures/doWhile.kt.match new file mode 100644 index 00000000000..8c287f9b064 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/doWhile.kt.match @@ -0,0 +1,9 @@ +do { + println((t)) + t++ + } while (t != (a + b)) + +do { + println(t) + t++ + } while (t != a + b) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/for.kt b/idea/testData/unifier/equivalence/controlStructures/for.kt new file mode 100644 index 00000000000..834bea5d228 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/for.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + for (i in a - b..a + b) { + println(i*i) + } + + for (k in a - b..a + b) { + println(k*k) + } + + for (i in a..a + b) { + println(i*i) + } + + for (i in (a - b..a + b)) { + println(i*i) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/for.kt.match b/idea/testData/unifier/equivalence/controlStructures/for.kt.match new file mode 100644 index 00000000000..13c4e6efb0e --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/for.kt.match @@ -0,0 +1,11 @@ +for (i in a - b..a + b) { + println(i*i) + } + +for (k in a - b..a + b) { + println(k*k) + } + +for (i in (a - b..a + b)) { + println(i*i) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/if.kt b/idea/testData/unifier/equivalence/controlStructures/if.kt new file mode 100644 index 00000000000..873e56deb7b --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/if.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + if ((a) + b > 0) { + println(a*(b)) + } + + println(a*b) + + if (a + b > 0) { + println(a*(b)) + } + + if (a + b > 0) { + println((a*b)) + } + else { + println(a + b) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/if.kt.match b/idea/testData/unifier/equivalence/controlStructures/if.kt.match new file mode 100644 index 00000000000..016e01a61fb --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/if.kt.match @@ -0,0 +1,7 @@ +if ((a) + b > 0) { + println(a*(b)) + } + +if (a + b > 0) { + println(a*(b)) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/ifElse.kt b/idea/testData/unifier/equivalence/controlStructures/ifElse.kt new file mode 100644 index 00000000000..1a808f5f91a --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/ifElse.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + if ((a) + b > 0) { + println(a*b) + } + + println(a*b) + + if (a + b > (0)) { + println(a*(b)) + } + else { + println(a + b) + } + + if (a + b > 0) { + println(a*b) + } + + if (a + (b) > 0) { + println(a*b) + } + else { + println((a + b)) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/ifElse.kt.match b/idea/testData/unifier/equivalence/controlStructures/ifElse.kt.match new file mode 100644 index 00000000000..4d74d7cf25b --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/ifElse.kt.match @@ -0,0 +1,13 @@ +if (a + b > (0)) { + println(a*(b)) + } + else { + println(a + b) + } + +if (a + (b) > 0) { + println(a*b) + } + else { + println((a + b)) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt b/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt new file mode 100644 index 00000000000..ee6a4b06423 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt @@ -0,0 +1,11 @@ +inline fun run(f: () -> Unit) = f() + +fun foo(a: Int) { + run { + run { + if (a > 0) return@foo + if (a < 0) return + return@foo + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt.match b/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt.match new file mode 100644 index 00000000000..83dca70de82 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt.match @@ -0,0 +1,3 @@ +return@foo + +return@foo \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/throw.kt b/idea/testData/unifier/equivalence/controlStructures/throw.kt new file mode 100644 index 00000000000..b96702ef8bf --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/throw.kt @@ -0,0 +1,6 @@ +fun foo() { + throw AssertionError() + throw NullPointerException() + AssertionError() + throw (AssertionError()) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/throw.kt.match b/idea/testData/unifier/equivalence/controlStructures/throw.kt.match new file mode 100644 index 00000000000..012ed7c0d47 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/throw.kt.match @@ -0,0 +1,3 @@ +throw AssertionError() + +throw (AssertionError()) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt b/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt new file mode 100644 index 00000000000..de75c3d008e --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt @@ -0,0 +1,6 @@ +// DISABLE-ERRORS +fun foo(a: Int) { + if (a > 0) return + if (a < 0) return a + return +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt.match b/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt.match new file mode 100644 index 00000000000..5cfe19014f6 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/unitReturn.kt.match @@ -0,0 +1,3 @@ +return + +return \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt b/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt new file mode 100644 index 00000000000..5543bfcdcc4 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt @@ -0,0 +1,8 @@ +// DISABLE-ERRORS +fun foo(a: Int): Int { + if (a > 0) return (a) + 1 + if (a < 0) return + if (a == 0) return a + return (a + 1) + return +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt.match b/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt.match new file mode 100644 index 00000000000..50d7ecd6258 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt.match @@ -0,0 +1,3 @@ +return (a) + 1 + +return (a + 1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt b/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt new file mode 100644 index 00000000000..d5d64bdf6a1 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + when((a)) { + 1 -> println(b) + (2) -> println((a - b)) + else -> println(a + b) + } + + when(a) { + 1 -> println(b) + 2 -> println(a - b) + } + + when { + a == 1 -> println(b) + a == 2 -> println(a - b) + else -> println(a + b) + } + + when(a) { + 1 -> println(b) + 2 -> println(a - b) + else -> println(a + b) + } + + when(a) { + 2 -> println(a - b) + 1 -> println(b) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt.match b/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt.match new file mode 100644 index 00000000000..92945ce8a6a --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt.match @@ -0,0 +1,11 @@ +when((a)) { + 1 -> println(b) + (2) -> println((a - b)) + else -> println(a + b) + } + +when(a) { + 1 -> println(b) + 2 -> println(a - b) + else -> println(a + b) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt b/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt new file mode 100644 index 00000000000..d700c35bb95 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + when { + (a == 1) -> println(b) + a == 2 -> println(a - b) + else -> println(a + b) + } + + when { + a == 1 -> println(b) + a == 2 -> println(a - b) + } + + when { + a == 1 -> println(b) + (a == 2) -> println((a - b)) + else -> println(a + b) + } + + when(a) { + 2 -> println(a - b) + 1 -> println(b) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt.match b/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt.match new file mode 100644 index 00000000000..fd787aebb78 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt.match @@ -0,0 +1,11 @@ +when { + (a == 1) -> println(b) + a == 2 -> println(a - b) + else -> println(a + b) + } + +when { + a == 1 -> println(b) + (a == 2) -> println((a - b)) + else -> println(a + b) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/while.kt b/idea/testData/unifier/equivalence/controlStructures/while.kt new file mode 100644 index 00000000000..ac2c094bcf7 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/while.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +fun foo(a: Int, b: Int) { + var t = a + while (t != (a + b)) { + println(t) + t++ + } + + var u = a + while (u != a + b) { + println(t) + t++ + } + + do { + println(t) + t++ + } while (t != a + b) + + while (t != a + b) { + println((t)) + t++ + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/controlStructures/while.kt.match b/idea/testData/unifier/equivalence/controlStructures/while.kt.match new file mode 100644 index 00000000000..2dc6bd538f6 --- /dev/null +++ b/idea/testData/unifier/equivalence/controlStructures/while.kt.match @@ -0,0 +1,9 @@ +while (t != (a + b)) { + println(t) + t++ + } + +while (t != a + b) { + println((t)) + t++ + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt new file mode 100644 index 00000000000..d14cae058b5 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt @@ -0,0 +1,28 @@ +fun foo() { + { + val t = object { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + val v = object { + val x = 1 + fun b() = x + 1 + val c: Int + get() = b() + 1 + } + } + + { + val w = object { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } + } +} diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt.match new file mode 100644 index 00000000000..b4588727ec7 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt.match @@ -0,0 +1,13 @@ +object { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + +object { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt new file mode 100644 index 00000000000..47a20c446bf --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt @@ -0,0 +1,24 @@ +fun foo() { + open class Z(p: Int) + trait T; + + { + class A: Z(1), T + } + + { + class B: Z(1), T + } + + { + class C: Z(1) + } + + { + class D: Z(2), T + } + + { + class E: T + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt.match new file mode 100644 index 00000000000..ecfd99eda3e --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt.match @@ -0,0 +1,3 @@ +class A: Z(1), T + +class B: Z(1), T \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt new file mode 100644 index 00000000000..ae23234a6b1 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt @@ -0,0 +1,25 @@ +// DISABLE-ERRORS +fun foo() { + trait T + open class Z(p: Int): T; + + { + class A: T by Z(1) + } + + { + class B: Z(1), T + } + + { + class C: Z(1) + } + + { + class D: T by Z(1) + } + + { + class E: T by Z(2) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt.match new file mode 100644 index 00000000000..db2869cd5c6 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt.match @@ -0,0 +1,3 @@ +class A: T by Z(1) + +class D: T by Z(1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt new file mode 100644 index 00000000000..84d411c37d1 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt @@ -0,0 +1,11 @@ +fun foo() { + class A + + class B { + + } + + class C { + val n: Int = 1 + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt.match new file mode 100644 index 00000000000..bc47a09e313 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt.match @@ -0,0 +1,5 @@ +class A + +class B { + + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt new file mode 100644 index 00000000000..67bc8c3d66f --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt @@ -0,0 +1,56 @@ +// DISABLE-ERRORS +fun foo() { + { + class A(p: Int = 1, val q: Int = p + 1) { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + class B(n: Int = 1, val q: Int = n + 1) { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } + } + + { + class C { + val x = 1 + fun b() = x + 1 + val c: Int + get() = b() + 1 + } + } + + { + class D(n: Int = 1, val m: Int = n + 1) { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + class E(val n: Int = 1, val q: Int = n + 1) { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + object F { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } +} diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt.match new file mode 100644 index 00000000000..525b412c1c8 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt.match @@ -0,0 +1,13 @@ +class A(p: Int = 1, val q: Int = p + 1) { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + +class B(n: Int = 1, val q: Int = n + 1) { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt new file mode 100644 index 00000000000..2389f6399da --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt @@ -0,0 +1,38 @@ +// DISABLE-ERRORS +fun foo() { + { + object A { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + class B { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + } + + { + object C { + val x = 1 + fun b() = x + 1 + val c: Int + get() = b() + 1 + } + } + + { + object D { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } + } +} diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt.match new file mode 100644 index 00000000000..d7f6f88125e --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt.match @@ -0,0 +1,13 @@ +object A { + val a = 1 + fun b() = a + 1 + val c: Int + get() = b() + 1 + } + +object D { + fun b() = a + 1 + val a = 1 + val c: Int + get() = b() + 1 + } diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt new file mode 100644 index 00000000000..4bb0b2997cc --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt @@ -0,0 +1,42 @@ +fun foo() { + { + open class Z(p: T) + trait T + class A: Z(1), T + } + + { + open class Z(r: A) + trait T + class B: Z(1), T + } + + { + open class T(r: A) + trait Z + class C: T(1), Z + } + + { + open class Z(q: T) + trait T + class D: Z(2), T + } + + { + open class Z(q: T) + class E: Z(1) + } + + { + open class Z(r: A) + trait T + class F: Z("1"), T + } + + { + open class Z(r: Int) + trait T + class B: Z(1), T + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt.match new file mode 100644 index 00000000000..501c419d4ed --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt.match @@ -0,0 +1,17 @@ +{ + open class Z(p: T) + trait T + class A: Z(1), T + } + +{ + open class Z(r: A) + trait T + class B: Z(1), T + } + +{ + open class T(r: A) + trait Z + class C: T(1), Z + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt new file mode 100644 index 00000000000..928a1a3a160 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt @@ -0,0 +1,137 @@ +// DISABLE-ERRORS +fun foo() { + class A { + fun a(x: Int): Int = b(x) + 1 + fun b(y: Int): Int = a(y) - 1 + + { + println(1) + } + + class X + inner class Y + trait T + object O + + val p = 1 + val q = p + 1 + + { + println(2) + } + + class object { + fun f() = 1 + val g = f() - 1 + } + } + + class B { + { + println(1) + } + + class X + + fun b(p: kotlin.Int): kotlin.Int = a(p) - 1 + + inner class Y + + val p = 1 + + class object { + fun f() = 1 + val g = f() - 1 + } + + { + println(2) + } + + object O + + val q = p + 1 + + fun a(p: kotlin.Int): kotlin.Int = b(p) + 1 + + trait T + } + + class C { + fun aa(x: Int): Int = bb(x) + 1 + fun bb(y: Int): Int = aa(y) - 1 + + { + println(1) + } + + class X + inner class Y + trait T + object O + + val p = 1 + val q = p + 1 + + { + println(2) + } + + class object { + fun f() = 1 + val g = f() - 1 + } + } + + class D { + fun a(x: Int): Int = b(x) + 1 + fun b(y: Int): Int = a(y) - 1 + + { + println(1) + } + + class X + inner class Y + trait T + object O + + val q = p + 1 + val p = 1 + + { + println(2) + } + + class object { + fun f() = 1 + val g = f() - 1 + } + } + + class E { + fun a(x: Int): Int = b(x) + 1 + fun b(y: Int): Int = a(y) - 1 + + { + println(1) + } + + class XX + inner class Y + trait T + object O + + val p = 1 + val q = p + 1 + + { + println(2) + } + + class object { + fun f() = 1 + val g = f() - 1 + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt.match new file mode 100644 index 00000000000..479d1a2ea22 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt.match @@ -0,0 +1,56 @@ +class A { + fun a(x: Int): Int = b(x) + 1 + fun b(y: Int): Int = a(y) - 1 + + { + println(1) + } + + class X + inner class Y + trait T + object O + + val p = 1 + val q = p + 1 + + { + println(2) + } + + class object { + fun f() = 1 + val g = f() - 1 + } + } + +class B { + { + println(1) + } + + class X + + fun b(p: kotlin.Int): kotlin.Int = a(p) - 1 + + inner class Y + + val p = 1 + + class object { + fun f() = 1 + val g = f() - 1 + } + + { + println(2) + } + + object O + + val q = p + 1 + + fun a(p: kotlin.Int): kotlin.Int = b(p) + 1 + + trait T + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt b/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt new file mode 100644 index 00000000000..bb7896ef51b --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt @@ -0,0 +1,25 @@ +fun foo() { + open class Z(p: Int) + trait T + trait U; + + { + class A: Z(1), T, U + } + + { + class B: Z(1), U, T + } + + { + class C: Z(1) + } + + { + class D: Z(1), T + } + + { + class E: Z(1), U + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt.match b/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt.match new file mode 100644 index 00000000000..db0c8f0b18a --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt.match @@ -0,0 +1,3 @@ +class A: Z(1), T, U + +class B: Z(1), U, T \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt new file mode 100644 index 00000000000..6e8c033be40 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME +fun foo(f: (Int) -> Unit) { + { (n: Int, s: String) -> + val a = n + 1 + println(s) + f(a) + } + + { (s: String, n: Int) -> + val a = n + 1 + println(s) + f(a) + } + + { (m: Int, r: String) -> + val b = m + 1 + println(r) + f(b) + } + + val g: (Int, String) -> Unit = { (a, b) -> + val m = a + 1 + println(b) + f(m) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt.match new file mode 100644 index 00000000000..21f65eab6ed --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt.match @@ -0,0 +1,17 @@ +{ (n: Int, s: String) -> + val a = n + 1 + println(s) + f(a) + } + +{ (m: Int, r: String) -> + val b = m + 1 + println(r) + f(b) + } + +{ (a, b) -> + val m = a + 1 + println(b) + f(m) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt new file mode 100644 index 00000000000..c4ac6f3cf15 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt @@ -0,0 +1,16 @@ +fun foo(f: (Int) -> Unit) { + { + val a = 1 + f(a) + } + + { + val b = 1 + f(b) + } + + val g: () -> Unit = { + val c = 1 + f(c) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt.match new file mode 100644 index 00000000000..d320e9b301a --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt.match @@ -0,0 +1,14 @@ +{ + val a = 1 + f(a) + } + +{ + val b = 1 + f(b) + } + +{ + val c = 1 + f(c) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt new file mode 100644 index 00000000000..2b725bff2a0 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +fun foo(f: (Int) -> Unit) { + { (m: Int, n: Int, s: String) -> + val a = n + m + println(s) + f(a) + } + + { (n: Int, s: String) -> + val a = n + 1 + println(s) + f(a) + } + + { Int.(n: Int, s: String) -> + val a = n + this + println(s) + f(a) + } + + { Int.(m: Int, r: String) -> + val b = m + this + println(r) + f(b) + } + + val g: Int.(Int, String) -> Unit = { (a, b) -> + val m = a + this + println(b) + f(m) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt.match new file mode 100644 index 00000000000..684b72ada1d --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt.match @@ -0,0 +1,17 @@ +{ Int.(n: Int, s: String) -> + val a = n + this + println(s) + f(a) + } + +{ Int.(m: Int, r: String) -> + val b = m + this + println(r) + f(b) + } + +{ (a, b) -> + val m = a + this + println(b) + f(m) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt new file mode 100644 index 00000000000..64b58749d51 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt @@ -0,0 +1,21 @@ +fun foo(f: (Int) -> Unit) { + { (n: Int) -> + val a = n + 1 + f(a) + } + + val x: (Int) -> Unit = { + val a = it + 1 + f(a) + } + + { (m: Int) -> + val b = m + 1 + f(b) + } + + val g: (Int) -> Unit = { a -> + val m = a + 1 + f(m) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match new file mode 100644 index 00000000000..00336007eab --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match @@ -0,0 +1,19 @@ +{ (n: Int) -> + val a = n + 1 + f(a) + } + +{ + val a = it + 1 + f(a) + } + +{ (m: Int) -> + val b = m + 1 + f(b) + } + +{ a -> + val m = a + 1 + f(m) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt new file mode 100644 index 00000000000..6945e82dc46 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt @@ -0,0 +1,16 @@ +fun foo() { + val a: () -> Unit = { + val t = 1 + t + } + + { + val v = 1 + v + } + + val b = { + val u = 1 + u + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt.match new file mode 100644 index 00000000000..36d50a1bc7b --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt.match @@ -0,0 +1,14 @@ +{ + val t = 1 + t + } + +{ + val v = 1 + v + } + +{ + val u = 1 + u + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt b/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt new file mode 100644 index 00000000000..6384fdfebc8 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt @@ -0,0 +1,24 @@ +class A(val n: Int) + +fun test() { + fun foo(t: T): Int { + fun A.a(n: Int): Int = this.n + n + fun A.b(n: Int): Int = this.n - n + + return t.n + A(1).a(2) - A(2).b(1) + } + + fun foo(u: U): Int { + fun A.x(m: Int): Int = n + m + fun A.y(n: Int): Int = this.n - n + + return u.n + A(1).x(2) - A(2).y(1) + } + + fun foo(v: V): Int { + fun A.a(n: Int): Int = this.n + n + fun A.b(n: Int): Int = this.n + n + + return v.n + A(1).a(2) - A(2).b(1) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt.match new file mode 100644 index 00000000000..c653c13cb05 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt.match @@ -0,0 +1,13 @@ +fun foo(t: T): Int { + fun A.a(n: Int): Int = this.n + n + fun A.b(n: Int): Int = this.n - n + + return t.n + A(1).a(2) - A(2).b(1) + } + +fun foo(u: U): Int { + fun A.x(m: Int): Int = n + m + fun A.y(n: Int): Int = this.n - n + + return u.n + A(1).x(2) - A(2).y(1) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt b/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt new file mode 100644 index 00000000000..70eff644c7d --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt @@ -0,0 +1,31 @@ +class A(val n: Int) + +fun test() { + fun foo(t: T): Int { + fun a(p: Int): Int = p + 1 + fun b(q: Int): Int = q - 1 + + return t.n + a(1) - b(2) + } + + fun foo(u: U): Int { + fun x(a: Int): Int = a + 1 + fun y(a: Int): Int = a - 1 + + return u.n + x(1) - y(2) + } + + fun foo(v: V): Int { + fun a(p: Int): Int = p + 1 + fun b(p: Int): Int = p + 1 + + return v.n + a(1) - b(2) + } + + fun a(p: Int): Int = p + 1 + fun b(q: Int): Int = q - 1 + + fun foo(w: W): Int { + return w.n + a(1) - b(2) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt.match new file mode 100644 index 00000000000..8727d647e10 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt.match @@ -0,0 +1,13 @@ +fun foo(t: T): Int { + fun a(p: Int): Int = p + 1 + fun b(q: Int): Int = q - 1 + + return t.n + a(1) - b(2) + } + +fun foo(u: U): Int { + fun x(a: Int): Int = a + 1 + fun y(a: Int): Int = a - 1 + + return u.n + x(1) - y(2) + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt b/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt new file mode 100644 index 00000000000..d4c32f14430 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt @@ -0,0 +1,34 @@ +fun foo1(): Int { + val a = 1 + var b = 2 + + return a - b +} + +fun foo2(): Int { + val x = 1 + var y = 2 + + return x - y +} + +fun foo3(): Int { + val x = 1 + val y = 2 + + return x - y +} + +fun foo4(): Int { + val a = 1 + var b = 0 + + return a - b +} + +val a = 1 +var b = 2 + +fun foo5(): Int { + return a - b +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt.match new file mode 100644 index 00000000000..27df37732a0 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt.match @@ -0,0 +1,13 @@ +{ + val a = 1 + var b = 2 + + return a - b +} + +{ + val x = 1 + var y = 2 + + return x - y +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt b/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt new file mode 100644 index 00000000000..d1a10ada3a6 --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt @@ -0,0 +1,20 @@ +data class A(val a: Int, val b: String) + +fun foo1() { + val (a, b) = A(1, "2") + val (u, v) = A(2, "2") + val (x, y) = A(1, "2") +} + +fun foo2() { + fun A.component1(): Int = a + 1 + + val (aa, bb) = A(1, "2") + val (uu, vv) = A(2, "2") + val (xx, yy) = A(1, "2") +} + +fun foo3() { + val (u, v) = A(2, "2") + val (x, y) = A(1, "2") +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt.match new file mode 100644 index 00000000000..2da427e33fe --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt.match @@ -0,0 +1,5 @@ +val (a, b) = A(1, "2") + +val (x, y) = A(1, "2") + +val (x, y) = A(1, "2") \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt b/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt new file mode 100644 index 00000000000..ea9822a363e --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt @@ -0,0 +1,17 @@ +fun foo() { + trait T + + fun bar1(a: A, b: B, c: C): A where B: A, C: B, C: T = c + + fun bar2(x: X, y: Y, z: Z): X where Z: Y, Z: T = z + + fun bar3(x: X, y: Y, z: Z): X where Y: X, Z: T = z + + fun bar4(x: X, y: Y, z: Z): X where Z: T = z + + fun bar5(x: X, y: Y, z: Z): X where Z: Y = z + + fun bar6(x: X, y: Y, z: Z): X where Y: X, Z: T = z + + fun bar7(x: X, y: Y, z: Z): X where Y: X, Z: Y, Z: T = z +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt.match b/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt.match new file mode 100644 index 00000000000..4102f194c9b --- /dev/null +++ b/idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt.match @@ -0,0 +1,9 @@ +fun bar1(a: A, b: B, c: C): A where B: A, C: B, C: T = c + +fun bar2(x: X, y: Y, z: Z): X where Z: Y, Z: T = z + +fun bar3(x: X, y: Y, z: Z): X where Y: X, Z: T = z + +fun bar4(x: X, y: Y, z: Z): X where Z: T = z + +fun bar5(x: X, y: Y, z: Z): X where Z: Y = z diff --git a/idea/testData/unifier/equivalence/expressions/arrayAccess.kt b/idea/testData/unifier/equivalence/expressions/arrayAccess.kt new file mode 100644 index 00000000000..a3199adc85e --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/arrayAccess.kt @@ -0,0 +1,5 @@ +fun foo(a: Array) { + a[0] + a[1] + a[0] = a[0] + a[1] +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/arrayAccess.kt.match b/idea/testData/unifier/equivalence/expressions/arrayAccess.kt.match new file mode 100644 index 00000000000..cb42cb867d8 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/arrayAccess.kt.match @@ -0,0 +1,3 @@ +a[0] + +a[0] \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt b/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt new file mode 100644 index 00000000000..965f38c9c76 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +class A { + inner class B + + inner class C + + fun foo() { + ::B + ::C + A::B + A::C + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt.match b/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt.match new file mode 100644 index 00000000000..6197af02bf6 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt.match @@ -0,0 +1,3 @@ +::B + +A::B \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt b/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt new file mode 100644 index 00000000000..f21cec00598 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME +class A { + fun bar() { + + } + + fun baz() { + + } + + fun foo() { + ::bar + ::baz + A::bar + A::baz + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt.match b/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt.match new file mode 100644 index 00000000000..ebeaac63ccc --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt.match @@ -0,0 +1,3 @@ +::bar + +A::bar \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt b/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt new file mode 100644 index 00000000000..6af4b5f888d --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt @@ -0,0 +1,14 @@ +class Bar { + { + Foo()() + } +} + +class Foo() { + fun Bar.invoke() {} +} + +fun foobar(f: Foo) { + Bar().f() + Bar().f() +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt.match b/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt.match new file mode 100644 index 00000000000..f68a12d7618 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt.match @@ -0,0 +1,3 @@ +Bar().f() + +Bar().f() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt b/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt new file mode 100644 index 00000000000..0e832251ca5 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME +fun Int.contains(n: Int): Boolean = n < this + +fun foo(n: Int): Int { + if (n in 1) { + println(1) + } + + when(n) { + in 1 -> println(1) + in 2 -> println(2) + } + + if (1.contains(n)) { + println(1) + } + + when(n) { + in 1 -> println(1) + } + + return 1 +} diff --git a/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt.match b/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt.match new file mode 100644 index 00000000000..c9dcdc6c178 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt.match @@ -0,0 +1,3 @@ +in 1 + +in 1 diff --git a/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt b/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt new file mode 100644 index 00000000000..6405093f411 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt @@ -0,0 +1,9 @@ +// DISABLE-ERRORS +fun bar(n: Int): Int = n + 1 + +fun foo() { + bar(1, 2) + bar(1) + bar(1, 2) + bar(2, 1) +} diff --git a/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt.match b/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt.match new file mode 100644 index 00000000000..03807e6a84b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt.match @@ -0,0 +1,3 @@ +bar(1, 2) + +bar(1, 2) diff --git a/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt b/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt new file mode 100644 index 00000000000..b63e0afe8c1 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt @@ -0,0 +1,11 @@ +class A { + fun bar() { + + } +} + +fun A.foo() { + bar() + this.bar() + this@foo.bar() +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt.match b/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt.match new file mode 100644 index 00000000000..b614ddf2a83 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt.match @@ -0,0 +1,5 @@ +bar() + +this.bar() + +this@foo.bar() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt b/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt new file mode 100644 index 00000000000..7aad7378810 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt @@ -0,0 +1,11 @@ +class A { + fun bar() { + + } + + fun foo() { + bar() + this.bar() + this@A.bar() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt.match b/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt.match new file mode 100644 index 00000000000..4a7f9fe116b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt.match @@ -0,0 +1,5 @@ +bar() + +this.bar() + +this@A.bar() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt b/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt new file mode 100644 index 00000000000..77c3449beef --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt @@ -0,0 +1,6 @@ +fun Any.s(): String = toString() + +fun foo() { + Any().s() + Any()?.s() +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt.match b/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt.match new file mode 100644 index 00000000000..c85959aa0ee --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/safeCall.kt.match @@ -0,0 +1 @@ +Any()?.s() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt b/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt new file mode 100644 index 00000000000..c2bf6637b2c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt @@ -0,0 +1,7 @@ +// DISABLE-ERRORS +fun foo() { + bar(1, 2) + bar(2, 1) + bar(1, 2) + bar(1) +} diff --git a/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt.match b/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt.match new file mode 100644 index 00000000000..03807e6a84b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/unresolved.kt.match @@ -0,0 +1,3 @@ +bar(1, 2) + +bar(1, 2) diff --git a/idea/testData/unifier/equivalence/expressions/calls/varargs.kt b/idea/testData/unifier/equivalence/expressions/calls/varargs.kt new file mode 100644 index 00000000000..d81fa8e5bbc --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/varargs.kt @@ -0,0 +1,8 @@ +fun bar(vararg n: Int) {} + +fun foo() { + bar(1, 2, 3) + bar(1, 2) + bar(1, 2, 3) + bar(*IntArray(3)) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/calls/varargs.kt.match b/idea/testData/unifier/equivalence/expressions/calls/varargs.kt.match new file mode 100644 index 00000000000..675b3be0c64 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/calls/varargs.kt.match @@ -0,0 +1,3 @@ +bar(1, 2, 3) + +bar(1, 2, 3) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/as.kt b/idea/testData/unifier/equivalence/expressions/casts/as.kt new file mode 100644 index 00000000000..872608169a4 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/as.kt @@ -0,0 +1,6 @@ +fun foo(a: Any, b: Any) { + a as String + a is String + b as String + a as? String +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/as.kt.match b/idea/testData/unifier/equivalence/expressions/casts/as.kt.match new file mode 100644 index 00000000000..01823a34497 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/as.kt.match @@ -0,0 +1 @@ +a as String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/is.kt b/idea/testData/unifier/equivalence/expressions/casts/is.kt new file mode 100644 index 00000000000..3f5c5fcf361 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/is.kt @@ -0,0 +1,5 @@ +fun foo(a: Any, b: Any) { + a is String + a as String + b is String +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/is.kt.match b/idea/testData/unifier/equivalence/expressions/casts/is.kt.match new file mode 100644 index 00000000000..7ccaa0c9744 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/is.kt.match @@ -0,0 +1 @@ +a is String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt b/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt new file mode 100644 index 00000000000..b951b31022a --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt @@ -0,0 +1,6 @@ +fun foo(a: Any, b: Any) { + a as? String + b as String + a is String + a as String +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt.match b/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt.match new file mode 100644 index 00000000000..41612495ee9 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/casts/safeAs.kt.match @@ -0,0 +1 @@ +a as? String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/const.kt b/idea/testData/unifier/equivalence/expressions/const.kt new file mode 100644 index 00000000000..25e03816a90 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/const.kt @@ -0,0 +1,6 @@ +fun foo() { + val t = 1 + t + 1 + val u = 1.0 + u + 2 +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/const.kt.match b/idea/testData/unifier/equivalence/expressions/const.kt.match new file mode 100644 index 00000000000..2b33fce9d1c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/const.kt.match @@ -0,0 +1,3 @@ +1 + +1 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt b/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt new file mode 100644 index 00000000000..8cfd8b40c80 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt @@ -0,0 +1,20 @@ +// DISABLE-ERRORS +class A(var n: Int) { + fun plusAssign(m: Int) { + n += m + } +} + +class Foo { + { + var a = Array(2) { A(it) } + a[1] += 2 + a[1] = a[1] + 2 + a.set(1, a[1] + 2) + a.set(1, a.get(1).plus(2)) + a[1] + 2 + a.get(1).plus(2) + a[1].plusAssign(2) + a.get(1).plusAssign(2) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt.match new file mode 100644 index 00000000000..b15d0a9c6be --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt.match @@ -0,0 +1,5 @@ +a[1] += 2 + +a[1].plusAssign(2) + +a.get(1).plusAssign(2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt new file mode 100644 index 00000000000..0a10be4d7e5 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt @@ -0,0 +1,15 @@ +// DISABLE-ERRORS +class A(val n: Int) { + fun plus(m: Int) = A(n + m) +} + +class Foo { + { + var a = A(0) + a += 2 + a = a + 2 + a + 2 + a.plus(2) + a.plusAssign(2) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt.match new file mode 100644 index 00000000000..acc86986e8c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt.match @@ -0,0 +1,3 @@ +a += 2 + +a = a + 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt new file mode 100644 index 00000000000..165650e6c92 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt @@ -0,0 +1,18 @@ +// DISABLE-ERRORS +class A(val n: Int) { + fun plus(m: Int) = A(n + m) +} + +class Foo { + { + var a = Array(2) { A(it) } + a[1] += 2 + a[1] = a[1] + 2 + a.set(1, a[1] + 2) + a.set(1, a.get(1).plus(2)) + a[1] + 2 + a.get(1).plus(2) + a[1].plusAssign(2) + a.get(1).plusAssign(2) + } +} diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt.match new file mode 100644 index 00000000000..f626ccc8acf --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt.match @@ -0,0 +1 @@ +a[1] += 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt new file mode 100644 index 00000000000..86421747797 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt @@ -0,0 +1,17 @@ +// DISABLE-ERRORS +class A(var n: Int) { + fun plusAssign(m: Int) { + n += m + } +} + +class Foo { + { + var a = A(0) + a += 2 + a = a + 2 + a + 2 + a.plus(2) + a.plusAssign(2) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt.match new file mode 100644 index 00000000000..7c7cf5b34ad --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt.match @@ -0,0 +1,3 @@ +a += 2 + +a.plusAssign(2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt b/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt new file mode 100644 index 00000000000..16b56b030b9 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt @@ -0,0 +1,10 @@ +// DISABLE-ERRORS +val array = Array(2) { it } + +class Foo { + { + array[1] = 10 + array.set(1, 10) + array2.set(1, 10) + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt.match new file mode 100644 index 00000000000..3b7f6bdc312 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt.match @@ -0,0 +1,3 @@ +array[1] = 10 + +array.set(1, 10) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/contains.kt b/idea/testData/unifier/equivalence/expressions/conventions/contains.kt new file mode 100644 index 00000000000..0aaa6030d9c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/contains.kt @@ -0,0 +1,13 @@ +// DISABLE-ERRORS +val array = Array(2) { it } +fun Array.contains(t: T): Boolean = false + +val a = 1 in array +val b = array.contains(1) +val c = 1.contains(array) +val d = 1 !in array +val e = { + when (1) { + in array -> {} + } +} diff --git a/idea/testData/unifier/equivalence/expressions/conventions/contains.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/contains.kt.match new file mode 100644 index 00000000000..7def39c1228 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/contains.kt.match @@ -0,0 +1,3 @@ +1 in array + +array.contains(1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/equals.kt b/idea/testData/unifier/equivalence/expressions/conventions/equals.kt new file mode 100644 index 00000000000..6f6868902c0 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/equals.kt @@ -0,0 +1,6 @@ +val a = 1 == 2 +val b = 1.equals(2) +val c = 2.equals(1) +val d = 1 === 2 +val e = 1 != 2 +val f = 1 !== 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/equals.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/equals.kt.match new file mode 100644 index 00000000000..3b19de2b4be --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/equals.kt.match @@ -0,0 +1,3 @@ +1 == 2 + +1.equals(2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/get.kt b/idea/testData/unifier/equivalence/expressions/conventions/get.kt new file mode 100644 index 00000000000..ade510cf3a5 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/get.kt @@ -0,0 +1,6 @@ +// DISABLE-ERRORS +val array = Array(2) { it } + +val a = array[1] +val b = array.get(1) +val c = array.get(1, 2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/get.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/get.kt.match new file mode 100644 index 00000000000..852f2c53392 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/get.kt.match @@ -0,0 +1,3 @@ +array[1] + +array.get(1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/inc.kt b/idea/testData/unifier/equivalence/expressions/conventions/inc.kt new file mode 100644 index 00000000000..46f5aea16a1 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/inc.kt @@ -0,0 +1,10 @@ +fun String.inc() = this + "+" + +class Foo { + { + var s = "" + s++ + s.inc() + s = s.inc() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/inc.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/inc.kt.match new file mode 100644 index 00000000000..d3ffc71585a --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/inc.kt.match @@ -0,0 +1 @@ +s++ \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt b/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt new file mode 100644 index 00000000000..82dd4f76110 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt @@ -0,0 +1,3 @@ +val a = 1 + 2 +val b = 1 plus 2 +val d = 2 plus 1 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match new file mode 100644 index 00000000000..e78ceb3c488 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match @@ -0,0 +1,3 @@ +1 + 2 + +1 plus 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt new file mode 100644 index 00000000000..67f6c82446c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt @@ -0,0 +1,8 @@ +// DISABLE-ERRORS +fun f(n: Int): Int = n +fun Int.invoke() = this + 1 + +val a = f(1)() +val b = f(1).invoke() +val c = invoke(f(1)) +val d = f(1).plus() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt.match new file mode 100644 index 00000000000..add70f03b2c --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt.match @@ -0,0 +1,3 @@ +f(1)() + +f(1).invoke() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt new file mode 100644 index 00000000000..4dea25c3a73 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt @@ -0,0 +1,7 @@ +// DISABLE-ERRORS +fun Int.invoke() = this + 1 + +val a = 1() +val b = 1.invoke() +val c = invoke(1) +val d = 1.plus() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt.match new file mode 100644 index 00000000000..5b484572236 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt.match @@ -0,0 +1,3 @@ +1() + +1.invoke() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt new file mode 100644 index 00000000000..84a7283e204 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt @@ -0,0 +1,9 @@ +// DISABLE-ERRORS +class X(val n: Int) +fun Int.invoke() = this + 1 + +val x = X(1) +val a = x.n() +val b = x.n.invoke() +val c = invoke(x.n) +val d = x.n.plus() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt.match new file mode 100644 index 00000000000..8b7a85aa38a --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt.match @@ -0,0 +1,3 @@ +x.n() + +x.n.invoke() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt new file mode 100644 index 00000000000..0da5bf94c6b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt @@ -0,0 +1,8 @@ +// DISABLE-ERRORS +fun Int.invoke() = this + 1 + +val x = 1 +val a = x() +val b = x.invoke() +val c = invoke(x) +val d = x.plus() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt.match new file mode 100644 index 00000000000..58074349db5 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt.match @@ -0,0 +1,3 @@ +x() + +x.invoke() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt b/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt new file mode 100644 index 00000000000..69f9bdb0f73 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt @@ -0,0 +1,6 @@ +val a = 1 < 2 +val b = 1.compareTo(2) < 0 +val c = 1.compareTo(2) +val d = 1 <= 2 +val e = 1 > 2 +val f = 1 == 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt.match new file mode 100644 index 00000000000..535e996ad9b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt.match @@ -0,0 +1 @@ +1 < 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt b/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt new file mode 100644 index 00000000000..d942f9608b7 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt @@ -0,0 +1,9 @@ +// DISABLE-ERRORS +val array = Array(2) { it } +fun Array.contains(t: T): Boolean = false + +val a = 1 in array +val b = array.contains(1) +val c = 1.contains(array) +val d = 1 !in array +val e = !array.contains(1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt.match new file mode 100644 index 00000000000..2bb26b78b82 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/notContains.kt.match @@ -0,0 +1 @@ +1 !in array \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt b/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt new file mode 100644 index 00000000000..71ab0c5fc93 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt @@ -0,0 +1,6 @@ +val a = 1 == 2 +val b = 1.equals(2) +val c = 1 === 2 +val d = 1 != 2 +val e = 1 !== 2 +val f = !1.equals(2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt.match new file mode 100644 index 00000000000..07a3f190097 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt.match @@ -0,0 +1 @@ +1 != 2 \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/plus.kt b/idea/testData/unifier/equivalence/expressions/conventions/plus.kt new file mode 100644 index 00000000000..566939ed5bb --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/plus.kt @@ -0,0 +1,4 @@ +// DISABLE-ERRORS +val a = 1 + 2 +val c = 1.plus(2) +val e = 1.plus(2, 3) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/plus.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/plus.kt.match new file mode 100644 index 00000000000..f6cf2f0e36a --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/plus.kt.match @@ -0,0 +1,3 @@ +1 + 2 + +1.plus(2) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt b/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt new file mode 100644 index 00000000000..aaa59248e06 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt @@ -0,0 +1,4 @@ +fun foo() { + -1 + 1.minus() +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt.match b/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt.match new file mode 100644 index 00000000000..1182c71c87f --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt.match @@ -0,0 +1,3 @@ +-1 + +1.minus() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc1.kt b/idea/testData/unifier/equivalence/expressions/misc/misc1.kt new file mode 100644 index 00000000000..539a42bb5df --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc1.kt @@ -0,0 +1,6 @@ +// DISABLE-ERRORS +fun foo() { + (a + b*x.f(n - 1)) + (a + b)*x.f(n - 1) + (a) + b*x.f(n - 1) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc1.kt.match b/idea/testData/unifier/equivalence/expressions/misc/misc1.kt.match new file mode 100644 index 00000000000..d0cbf577f42 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc1.kt.match @@ -0,0 +1,3 @@ +(a + b*x.f(n - 1)) + +(a) + b*x.f(n - 1) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc2.kt b/idea/testData/unifier/equivalence/expressions/misc/misc2.kt new file mode 100644 index 00000000000..d7e38d16a99 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc2.kt @@ -0,0 +1,6 @@ +// DISABLE-ERRORS +fun foo() { + (a.foo((n + 2)*(m - 1))[k[i]] is MyClass?) || (b.foo(n - 2)[i + 1] !is YourClass) + a.foo((n + 2*m - 1))[k[i]] is MyClass? || b.foo[n - 2](i + 1) !is YourClass + a.foo((n + 2)*(m - 1))[k[i]] is MyClass? || b.foo(n - 2)[i + 1] !is YourClass +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc2.kt.match b/idea/testData/unifier/equivalence/expressions/misc/misc2.kt.match new file mode 100644 index 00000000000..46c0338f52b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc2.kt.match @@ -0,0 +1,3 @@ +(a.foo((n + 2)*(m - 1))[k[i]] is MyClass?) || (b.foo(n - 2)[i + 1] !is YourClass) + +a.foo((n + 2)*(m - 1))[k[i]] is MyClass? || b.foo(n - 2)[i + 1] !is YourClass \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc3.kt b/idea/testData/unifier/equivalence/expressions/misc/misc3.kt new file mode 100644 index 00000000000..46477e6ef14 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc3.kt @@ -0,0 +1,6 @@ +// DISABLE-ERRORS +fun foo() { + a > b[n] && (a < foo(x.bar(n + 2)) || a == n) && b[n - 1] != foo(a + 2) + a > b[n] && a < foo(x.bar(n + 2)) || (a == n) && (b[n - 1] != foo(a + 2)) + a > b[n] && (a < foo(x.bar(n + 2)) || (a == n)) && (b[n - 1] != foo(a + 2)) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/misc/misc3.kt.match b/idea/testData/unifier/equivalence/expressions/misc/misc3.kt.match new file mode 100644 index 00000000000..3dac5b1ec70 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/misc/misc3.kt.match @@ -0,0 +1,3 @@ +a > b[n] && (a < foo(x.bar(n + 2)) || a == n) && b[n - 1] != foo(a + 2) + +a > b[n] && (a < foo(x.bar(n + 2)) || (a == n)) && (b[n - 1] != foo(a + 2)) \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/qualifiedName.kt b/idea/testData/unifier/equivalence/expressions/qualifiedName.kt new file mode 100644 index 00000000000..a892d40e0f1 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/qualifiedName.kt @@ -0,0 +1,20 @@ +// ERROR: Unresolved reference: B +package p.q.r + +class A { + class B { + val n = 1 + + fun foo() { + B().n + A.B().n + p.q.r.A.B().n + } + } +} + +fun foo() { + B().n + A.B().n + p.q.r.A.B().n +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/qualifiedName.kt.match b/idea/testData/unifier/equivalence/expressions/qualifiedName.kt.match new file mode 100644 index 00000000000..ea7abc13e09 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/qualifiedName.kt.match @@ -0,0 +1,9 @@ +B().n + +A.B().n + +p.q.r.A.B().n + +A.B().n + +p.q.r.A.B().n \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/simpleName.kt b/idea/testData/unifier/equivalence/expressions/simpleName.kt new file mode 100644 index 00000000000..0e444fd86e3 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/simpleName.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME +var a = 1 +val b = a + 1 + +fun foo() { + println(a - 1) + val a = 2 + println(a - 1) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/simpleName.kt.match b/idea/testData/unifier/equivalence/expressions/simpleName.kt.match new file mode 100644 index 00000000000..89f43bb0db3 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/simpleName.kt.match @@ -0,0 +1,3 @@ +a + +a \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/stringTemplate.kt b/idea/testData/unifier/equivalence/expressions/stringTemplate.kt new file mode 100644 index 00000000000..4e43af239f4 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/stringTemplate.kt @@ -0,0 +1,7 @@ +fun foo(n: Int, f: (Int) -> Int) { + "test: $n, ${f(n)}" + "test: ${n}, ${f(n)}" + "test: ${f(n)}, ${n}" + "test: n, ${f(n)}" + "test: $n, $f" +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/stringTemplate.kt.match b/idea/testData/unifier/equivalence/expressions/stringTemplate.kt.match new file mode 100644 index 00000000000..f900c57a474 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/stringTemplate.kt.match @@ -0,0 +1,3 @@ +"test: $n, ${f(n)}" + +"test: ${n}, ${f(n)}" \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt b/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt new file mode 100644 index 00000000000..ae8e66e4b37 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt @@ -0,0 +1,18 @@ +trait T { + fun foo() { + + } +} + +open class Z { + open fun foo() { + + } +} + +class A: Z(), T { + override fun foo() { + super.foo() + super.foo() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt.match b/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt.match new file mode 100644 index 00000000000..7d9ef3391cb --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt.match @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt new file mode 100644 index 00000000000..d3a9a91bb22 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt @@ -0,0 +1,38 @@ +open class Z { + open fun foo() { + + } +} + +class A: Z() { + inner class B: Z() { + inner class C: Z() { + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super.foo() + super@A.foo() + super@B.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super.foo() + super@A.foo() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt.match b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt.match new file mode 100644 index 00000000000..c7d61e6b238 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt.match @@ -0,0 +1,15 @@ +super@A.foo() + +super@A.foo() + +super@A.foo() + +super@A.foo() + +super.foo() + +super@A.foo() + +super.foo() + +super@A.foo() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt new file mode 100644 index 00000000000..c179cb5a796 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt @@ -0,0 +1,38 @@ +open class Z { + open fun foo() { + + } +} + +class A: Z() { + inner class B: Z() { + inner class C: Z() { + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super.foo() + super@A.foo() + super@B.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super.foo() + super@A.foo() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt.match b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt.match new file mode 100644 index 00000000000..0a564623aa8 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt.match @@ -0,0 +1,11 @@ +super@B.foo() + +super@B.foo() + +super.foo() + +super@B.foo() + +super.foo() + +super@B.foo() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt new file mode 100644 index 00000000000..4e6cc5aa8d1 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt @@ -0,0 +1,38 @@ +open class Z { + open fun foo() { + + } +} + +class A: Z() { + inner class B: Z() { + inner class C: Z() { + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + super.foo() + super@A.foo() + super@B.foo() + super@C.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super@B.foo() + super.foo() + super@A.foo() + super@B.foo() + } + } + + override fun foo() { + super.foo() + super@A.foo() + super.foo() + super@A.foo() + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt.match b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt.match new file mode 100644 index 00000000000..c429fdc37d7 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt.match @@ -0,0 +1,7 @@ +super.foo() + +super@C.foo() + +super.foo() + +super@C.foo() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt b/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt new file mode 100644 index 00000000000..65a75abfa72 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt @@ -0,0 +1,17 @@ +trait Foo { + fun foo() +} + +fun foo() { + val a = object: Foo { + override fun foo() { + this + } + } + + val b = object: Foo { + override fun foo() { + this + } + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt.match b/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt.match new file mode 100644 index 00000000000..d4d24884038 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt.match @@ -0,0 +1,11 @@ +object: Foo { + override fun foo() { + this + } + } + +object: Foo { + override fun foo() { + this + } + } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt new file mode 100644 index 00000000000..97c74731181 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt @@ -0,0 +1,23 @@ +class A { + inner class B { + inner class C { + fun foo() { + this + this@A + this@B + this@C + } + } + + fun foo() { + this + this@A + this@B + } + } + + fun foo() { + this + this@A + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt.match new file mode 100644 index 00000000000..0492912de05 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt.match @@ -0,0 +1,7 @@ +this@A + +this@A + +this + +this@A \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt new file mode 100644 index 00000000000..5f9195b9267 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt @@ -0,0 +1,23 @@ +class A { + inner class B { + inner class C { + fun foo() { + this + this@A + this@B + this@C + } + } + + fun foo() { + this + this@A + this@B + } + } + + fun foo() { + this + this@A + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt.match new file mode 100644 index 00000000000..990cad0eaab --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt.match @@ -0,0 +1,5 @@ +this@B + +this + +this@B \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt new file mode 100644 index 00000000000..12fc37d06aa --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt @@ -0,0 +1,23 @@ +class A { + inner class B { + inner class C { + fun foo() { + this + this@A + this@B + this@C + } + } + + fun foo() { + this + this@A + this@B + } + } + + fun foo() { + this + this@A + } +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt.match new file mode 100644 index 00000000000..7667909c07b --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt.match @@ -0,0 +1,3 @@ +this + +this@C \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt new file mode 100644 index 00000000000..771c307eb65 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt @@ -0,0 +1,19 @@ +class A + +fun A.foo() { + fun A.bar() { + fun A.baz() { + this + this@baz + this@bar + this@foo + } + + this + this@bar + this@foo + } + + this + this@foo +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt.match new file mode 100644 index 00000000000..336cba54cec --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt.match @@ -0,0 +1,7 @@ +this@foo + +this@foo + +this + +this@foo \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt new file mode 100644 index 00000000000..7c9f8041b87 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt @@ -0,0 +1,19 @@ +class A + +fun A.foo() { + fun A.bar() { + fun A.baz() { + this + this@baz + this@bar + this@foo + } + + this + this@bar + this@foo + } + + this + this@foo +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt.match new file mode 100644 index 00000000000..89e001abe12 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt.match @@ -0,0 +1,5 @@ +this@bar + +this + +this@bar \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt new file mode 100644 index 00000000000..a487828e9ff --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt @@ -0,0 +1,19 @@ +class A + +fun A.foo() { + fun A.bar() { + fun A.baz() { + this + this@baz + this@bar + this@foo + } + + this + this@bar + this@foo + } + + this + this@foo +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt.match b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt.match new file mode 100644 index 00000000000..76b6a0969c7 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt.match @@ -0,0 +1,3 @@ +this + +this@baz \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt b/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt new file mode 100644 index 00000000000..3e0161d6a48 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME +class A { + fun foo() { + println(this) + } + + fun bar() { + println(this) + } +} + +class B { + fun foo() { + println(this) + } + + fun bar() { + println(this) + } +} + +fun A.foo() { + println(this) +} + +fun A.bar() { + println(this) +} + +fun B.foo() { + println(this) +} + +fun B.bar() { + println(this) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt.match b/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt.match new file mode 100644 index 00000000000..b1b7f456e43 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt.match @@ -0,0 +1,3 @@ +this + +this \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt b/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt new file mode 100644 index 00000000000..b7ec38f1c49 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME +class A { + fun foo() { + println(this) + } + + fun bar() { + println(this) + } +} + +class B { + fun foo() { + println(this) + } + + fun bar() { + println(this) + } +} + +fun A.foo() { + println(this) +} + +fun A.bar() { + println(this) +} + +fun B.foo() { + println(this) +} + +fun B.bar() { + println(this) +} \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt.match b/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt.match new file mode 100644 index 00000000000..a2a3f4f1e30 --- /dev/null +++ b/idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt.match @@ -0,0 +1 @@ +this \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function0.kt b/idea/testData/unifier/equivalence/types/function0.kt new file mode 100644 index 00000000000..2abc4a87d17 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function0.kt @@ -0,0 +1,7 @@ +val a: Function0 = { "" } +val b: kotlin.Function0 = { "" } +val c: () -> String = { "" } +val d: () -> kotlin.String = { "" } +val e: () -> Unit = { } +val f: Any.() -> String = { "" } +val g: ExtensionFunction0 = { "" } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function0.kt.match b/idea/testData/unifier/equivalence/types/function0.kt.match new file mode 100644 index 00000000000..f72c1115cd2 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function0.kt.match @@ -0,0 +1,7 @@ +Function0 + +kotlin.Function0 + +() -> String + +() -> kotlin.String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function1.kt b/idea/testData/unifier/equivalence/types/function1.kt new file mode 100644 index 00000000000..8304a146185 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function1.kt @@ -0,0 +1,10 @@ +val a: Function1 = { "" } +val b: kotlin.Function1 = { "" } +val c: (Int) -> String = { "" } +val d: (n: Int) -> kotlin.String = { "" } +val e: (String) -> Int = { 0 } +val f: () -> Int = { 0 } +val g: Int.() -> String = { "" } +val h: ExtensionFunction1 = { "" } +val i: (m: Int) -> kotlin.String = { "" } +val j: ExtensionFunction0 = { "" } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function1.kt.match b/idea/testData/unifier/equivalence/types/function1.kt.match new file mode 100644 index 00000000000..f1d28f35014 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function1.kt.match @@ -0,0 +1,9 @@ +Function1 + +kotlin.Function1 + +(Int) -> String + +(n: Int) -> kotlin.String + +(m: Int) -> kotlin.String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function2.kt b/idea/testData/unifier/equivalence/types/function2.kt new file mode 100644 index 00000000000..d48c0606304 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function2.kt @@ -0,0 +1,11 @@ +val a: Function2 = { (a, b) -> "" } +val b: kotlin.Function2 = { (a, b) -> "" } +val c: (Any, Int) -> String = { (a, b) -> "" } +val d: (a: Any, n: Int) -> kotlin.String = { (a, b) -> "" } +val e: (String) -> Int = { 0 } +val f: () -> Int = { 0 } +val g: Any.(Int) -> String = { "" } +val h: Int.(Any) -> String = { "" } +val i: ExtensionFunction2 = { (a, b) -> "" } +val j: (t: Any, u: Int) -> kotlin.String = {(a, b) -> "" } +val k: ExtensionFunction1 = { "" } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/function2.kt.match b/idea/testData/unifier/equivalence/types/function2.kt.match new file mode 100644 index 00000000000..9eee15c239e --- /dev/null +++ b/idea/testData/unifier/equivalence/types/function2.kt.match @@ -0,0 +1,9 @@ +Function2 + +kotlin.Function2 + +(Any, Int) -> String + +(a: Any, n: Int) -> kotlin.String + +(t: Any, u: Int) -> kotlin.String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/nonNullable.kt b/idea/testData/unifier/equivalence/types/nonNullable.kt new file mode 100644 index 00000000000..d84efa113f0 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/nonNullable.kt @@ -0,0 +1,4 @@ +val a: String = "" +val b: String? = "" +val c: kotlin.String? = "" +val d: kotlin.String = "" \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/nonNullable.kt.match b/idea/testData/unifier/equivalence/types/nonNullable.kt.match new file mode 100644 index 00000000000..9480b4c56e0 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/nonNullable.kt.match @@ -0,0 +1,3 @@ +String + +kotlin.String \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/nullable.kt b/idea/testData/unifier/equivalence/types/nullable.kt new file mode 100644 index 00000000000..0a59a7d654f --- /dev/null +++ b/idea/testData/unifier/equivalence/types/nullable.kt @@ -0,0 +1,4 @@ +val a: String = "" +val b: String? = "" +val c: kotlin.String? = "" +val d: kotlin.String = "" \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/nullable.kt.match b/idea/testData/unifier/equivalence/types/nullable.kt.match new file mode 100644 index 00000000000..7f2e6726dc7 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/nullable.kt.match @@ -0,0 +1,3 @@ +String? + +kotlin.String? \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/userType.kt b/idea/testData/unifier/equivalence/types/userType.kt new file mode 100644 index 00000000000..eb16c3143c7 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/userType.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME +import java.util.HashMap + +val a: Map> = HashMap() +val b: MutableMap> = HashMap() +val c: Map> = HashMap() +val d: Map> = HashMap() +val e: Map> = HashMap() +val f: kotlin.Map> = HashMap() \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/types/userType.kt.match b/idea/testData/unifier/equivalence/types/userType.kt.match new file mode 100644 index 00000000000..b150a574ce5 --- /dev/null +++ b/idea/testData/unifier/equivalence/types/userType.kt.match @@ -0,0 +1,3 @@ +Map> + +kotlin.Map> \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/psi/patternMatching/AbstractJetPsiUnifierTest.kt b/idea/tests/org/jetbrains/jet/psi/patternMatching/AbstractJetPsiUnifierTest.kt new file mode 100644 index 00000000000..3a5ea4e0cc9 --- /dev/null +++ b/idea/tests/org/jetbrains/jet/psi/patternMatching/AbstractJetPsiUnifierTest.kt @@ -0,0 +1,71 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.psi.patternMatching + +import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase +import com.intellij.testFramework.LightProjectDescriptor +import org.jetbrains.jet.plugin.JetLightProjectDescriptor +import org.jetbrains.jet.lang.psi.JetFile +import org.jetbrains.jet.lang.psi.psiUtil.parents +import com.intellij.openapi.util.TextRange +import org.jetbrains.jet.lang.psi.JetElement +import org.jetbrains.jet.plugin.util.psi.patternMatching.JetPsiUnifier +import org.jetbrains.jet.plugin.caches.resolve.getBindingContext +import org.jetbrains.jet.plugin.util.psi.patternMatching.toRange +import java.io.File +import org.jetbrains.jet.JetTestUtils +import org.jetbrains.jet.lang.psi.JetExpression +import org.jetbrains.jet.lang.psi.JetTypeReference +import org.jetbrains.jet.lang.psi.JetWhenCondition +import org.jetbrains.jet.plugin.DirectiveBasedActionUtils +import org.jetbrains.jet.InTextDirectivesUtils +import org.jetbrains.jet.testing.ConfigLibraryUtil +import org.jetbrains.jet.plugin.PluginTestCaseBase + +public abstract class AbstractJetPsiUnifierTest: JetLightCodeInsightFixtureTestCase() { + public fun doTest(filePath: String) { + fun findPattern(file: JetFile): JetElement { + val selectionModel = myFixture.getEditor().getSelectionModel() + val start = selectionModel.getSelectionStart() + val end = selectionModel.getSelectionEnd() + val selectionRange = TextRange(start, end) + return file.findElementAt(start)?.parents()?.last { + (it is JetExpression || it is JetTypeReference || it is JetWhenCondition) + && selectionRange.contains(it.getTextRange() ?: TextRange.EMPTY_RANGE) + } as JetElement + } + + myFixture.configureByFile(filePath) + val file = myFixture.getFile() as JetFile + + if (InTextDirectivesUtils.findStringWithPrefixes(file.getText(), "// WITH_RUNTIME") != null) { + ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk()) + } + + DirectiveBasedActionUtils.checkForUnexpectedErrors(file) + + val actualText = + findPattern(file) + .toRange() + .match(file, JetPsiUnifier.DEFAULT) + .map { it.range.getTextRange().substring(file.getText()!!) } + .joinToString("\n\n") + JetTestUtils.assertEqualsToFile(File("$filePath.match"), actualText) + } + + override fun getProjectDescriptor(): LightProjectDescriptor = JetLightProjectDescriptor.INSTANCE +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/psi/patternMatching/JetPsiUnifierTestGenerated.java b/idea/tests/org/jetbrains/jet/psi/patternMatching/JetPsiUnifierTestGenerated.java new file mode 100644 index 00000000000..d76e84f3c0e --- /dev/null +++ b/idea/tests/org/jetbrains/jet/psi/patternMatching/JetPsiUnifierTestGenerated.java @@ -0,0 +1,802 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.psi.patternMatching; + +import com.intellij.testFramework.TestDataPath; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; +import org.jetbrains.jet.JUnit3RunnerWithInners; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/unifier") +@TestDataPath("$PROJECT_ROOT") +@InnerTestClasses({JetPsiUnifierTestGenerated.Equivalence.class}) +@RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) +public class JetPsiUnifierTestGenerated extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInUnifier() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("idea/testData/unifier/equivalence") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({Equivalence.ControlStructures.class, Equivalence.Declarations.class, Equivalence.Expressions.class, Equivalence.Types.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Equivalence extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInEquivalence() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("idea/testData/unifier/equivalence/controlStructures") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({ControlStructures.Blocks.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class ControlStructures extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInControlStructures() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/controlStructures"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("break.kt") + public void testBreak() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/break.kt"); + doTest(fileName); + } + + @TestMetadata("continue.kt") + public void testContinue() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/continue.kt"); + doTest(fileName); + } + + @TestMetadata("doWhile.kt") + public void testDoWhile() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/doWhile.kt"); + doTest(fileName); + } + + @TestMetadata("for.kt") + public void testFor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/for.kt"); + doTest(fileName); + } + + @TestMetadata("if.kt") + public void testIf() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/if.kt"); + doTest(fileName); + } + + @TestMetadata("ifElse.kt") + public void testIfElse() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/ifElse.kt"); + doTest(fileName); + } + + @TestMetadata("labeledReturn.kt") + public void testLabeledReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/labeledReturn.kt"); + doTest(fileName); + } + + @TestMetadata("throw.kt") + public void testThrow() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/throw.kt"); + doTest(fileName); + } + + @TestMetadata("unitReturn.kt") + public void testUnitReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/unitReturn.kt"); + doTest(fileName); + } + + @TestMetadata("valuedReturn.kt") + public void testValuedReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/valuedReturn.kt"); + doTest(fileName); + } + + @TestMetadata("whenWithSubject.kt") + public void testWhenWithSubject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/whenWithSubject.kt"); + doTest(fileName); + } + + @TestMetadata("whenWithoutSubject.kt") + public void testWhenWithoutSubject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/whenWithoutSubject.kt"); + doTest(fileName); + } + + @TestMetadata("while.kt") + public void testWhile() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/while.kt"); + doTest(fileName); + } + + @TestMetadata("idea/testData/unifier/equivalence/controlStructures/blocks") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Blocks extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInBlocks() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/controlStructures/blocks"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("anonymousObjects.kt") + public void testAnonymousObjects() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/blocks/anonymousObjects.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctions.kt") + public void testLocalFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/blocks/localFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("localVars.kt") + public void testLocalVars() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/controlStructures/blocks/localVars.kt"); + doTest(fileName); + } + + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/declarations") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({Declarations.ClassesAndObjects.class, Declarations.LocalCallables.class, Declarations.TypeParameters.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Declarations extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInDeclarations() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/declarations"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class ClassesAndObjects extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInClassesAndObjects() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/declarations/classesAndObjects"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("anonymousObjectBody.kt") + public void testAnonymousObjectBody() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/anonymousObjectBody.kt"); + doTest(fileName); + } + + @TestMetadata("commonSuperclasses.kt") + public void testCommonSuperclasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/commonSuperclasses.kt"); + doTest(fileName); + } + + @TestMetadata("delegation.kt") + public void testDelegation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/delegation.kt"); + doTest(fileName); + } + + @TestMetadata("emptyBody.kt") + public void testEmptyBody() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/emptyBody.kt"); + doTest(fileName); + } + + @TestMetadata("localClassBody.kt") + public void testLocalClassBody() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/localClassBody.kt"); + doTest(fileName); + } + + @TestMetadata("localObjectBody.kt") + public void testLocalObjectBody() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/localObjectBody.kt"); + doTest(fileName); + } + + @TestMetadata("matchedSuperclasses.kt") + public void testMatchedSuperclasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/matchedSuperclasses.kt"); + doTest(fileName); + } + + @TestMetadata("members.kt") + public void testMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/members.kt"); + doTest(fileName); + } + + @TestMetadata("superTypeOrder.kt") + public void testSuperTypeOrder() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/classesAndObjects/superTypeOrder.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/declarations/localCallables") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({LocalCallables.Lambdas.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class LocalCallables extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInLocalCallables() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/declarations/localCallables"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("localExtensionFunctions.kt") + public void testLocalExtensionFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/localExtensionFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctions.kt") + public void testLocalFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/localFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("localVariables.kt") + public void testLocalVariables() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/localVariables.kt"); + doTest(fileName); + } + + @TestMetadata("multiDeclaration.kt") + public void testMultiDeclaration() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt"); + doTest(fileName); + } + + @TestMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Lambdas extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInLambdas() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/declarations/localCallables/lambdas"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("multipleParams.kt") + public void testMultipleParams() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParams.kt"); + doTest(fileName); + } + + @TestMetadata("noParams.kt") + public void testNoParams() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas/noParams.kt"); + doTest(fileName); + } + + @TestMetadata("receiverArguments.kt") + public void testReceiverArguments() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas/receiverArguments.kt"); + doTest(fileName); + } + + @TestMetadata("singleParam.kt") + public void testSingleParam() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt"); + doTest(fileName); + } + + @TestMetadata("unitCoercion.kt") + public void testUnitCoercion() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/localCallables/lambdas/unitCoercion.kt"); + doTest(fileName); + } + + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/declarations/typeParameters") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class TypeParameters extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInTypeParameters() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/declarations/typeParameters"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("boundsAndConstraints.kt") + public void testBoundsAndConstraints() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/declarations/typeParameters/boundsAndConstraints.kt"); + doTest(fileName); + } + + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({Expressions.CallableReferences.class, Expressions.Calls.class, Expressions.Casts.class, Expressions.Conventions.class, Expressions.Misc.class, Expressions.Super.class, Expressions.This.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Expressions extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInExpressions() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("arrayAccess.kt") + public void testArrayAccess() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/arrayAccess.kt"); + doTest(fileName); + } + + @TestMetadata("const.kt") + public void testConst() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/const.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedName.kt") + public void testQualifiedName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/qualifiedName.kt"); + doTest(fileName); + } + + @TestMetadata("simpleName.kt") + public void testSimpleName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/simpleName.kt"); + doTest(fileName); + } + + @TestMetadata("stringTemplate.kt") + public void testStringTemplate() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/stringTemplate.kt"); + doTest(fileName); + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/callableReferences") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class CallableReferences extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInCallableReferences() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("classRef.kt") + public void testClassRef() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/callableReferences/classRef.kt"); + doTest(fileName); + } + + @TestMetadata("functionRef.kt") + public void testFunctionRef() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/callableReferences/functionRef.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/calls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Calls extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInCalls() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/calls"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("bothReceivers.kt") + public void testBothReceivers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/bothReceivers.kt"); + doTest(fileName); + } + + @TestMetadata("externalArguments.kt") + public void testExternalArguments() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/externalArguments.kt"); + doTest(fileName); + } + + @TestMetadata("extraArguments.kt") + public void testExtraArguments() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/extraArguments.kt"); + doTest(fileName); + } + + @TestMetadata("implicitReceiverArgument.kt") + public void testImplicitReceiverArgument() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/implicitReceiverArgument.kt"); + doTest(fileName); + } + + @TestMetadata("implicitThis.kt") + public void testImplicitThis() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/implicitThis.kt"); + doTest(fileName); + } + + @TestMetadata("safeCall.kt") + public void testSafeCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/safeCall.kt"); + doTest(fileName); + } + + @TestMetadata("unresolved.kt") + public void testUnresolved() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/unresolved.kt"); + doTest(fileName); + } + + @TestMetadata("varargs.kt") + public void testVarargs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/calls/varargs.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/casts") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Casts extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInCasts() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/casts"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("as.kt") + public void testAs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/casts/as.kt"); + doTest(fileName); + } + + @TestMetadata("is.kt") + public void testIs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/casts/is.kt"); + doTest(fileName); + } + + @TestMetadata("safeAs.kt") + public void testSafeAs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/casts/safeAs.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/conventions") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({Conventions.Assignments.class, Conventions.Invoke.class}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Conventions extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInConventions() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/conventions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("contains.kt") + public void testContains() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/contains.kt"); + doTest(fileName); + } + + @TestMetadata("equals.kt") + public void testEquals() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/equals.kt"); + doTest(fileName); + } + + @TestMetadata("get.kt") + public void testGet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/get.kt"); + doTest(fileName); + } + + @TestMetadata("inc.kt") + public void testInc() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/inc.kt"); + doTest(fileName); + } + + @TestMetadata("infixCall.kt") + public void testInfixCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/infixCall.kt"); + doTest(fileName); + } + + @TestMetadata("lessThan.kt") + public void testLessThan() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/lessThan.kt"); + doTest(fileName); + } + + @TestMetadata("notContains.kt") + public void testNotContains() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/notContains.kt"); + doTest(fileName); + } + + @TestMetadata("notEquals.kt") + public void testNotEquals() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/notEquals.kt"); + doTest(fileName); + } + + @TestMetadata("plus.kt") + public void testPlus() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/plus.kt"); + doTest(fileName); + } + + @TestMetadata("unaryMinus.kt") + public void testUnaryMinus() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/unaryMinus.kt"); + doTest(fileName); + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Assignments extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInAssignments() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/conventions/assignments"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("indexedPlusAssign.kt") + public void testIndexedPlusAssign() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments/indexedPlusAssign.kt"); + doTest(fileName); + } + + @TestMetadata("plusAndAssign.kt") + public void testPlusAndAssign() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssign.kt"); + doTest(fileName); + } + + @TestMetadata("plusAndAssignWithSet.kt") + public void testPlusAndAssignWithSet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAndAssignWithSet.kt"); + doTest(fileName); + } + + @TestMetadata("plusAssign.kt") + public void testPlusAssign() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments/plusAssign.kt"); + doTest(fileName); + } + + @TestMetadata("set.kt") + public void testSet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/assignments/set.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/conventions/invoke") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Invoke extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInInvoke() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/conventions/invoke"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("invokeOnCall.kt") + public void testInvokeOnCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnCall.kt"); + doTest(fileName); + } + + @TestMetadata("invokeOnConst.kt") + public void testInvokeOnConst() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnConst.kt"); + doTest(fileName); + } + + @TestMetadata("invokeOnQualified.kt") + public void testInvokeOnQualified() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnQualified.kt"); + doTest(fileName); + } + + @TestMetadata("invokeOnVar.kt") + public void testInvokeOnVar() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/conventions/invoke/invokeOnVar.kt"); + doTest(fileName); + } + + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/misc") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Misc extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInMisc() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/misc"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("misc1.kt") + public void testMisc1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/misc/misc1.kt"); + doTest(fileName); + } + + @TestMetadata("misc2.kt") + public void testMisc2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/misc/misc2.kt"); + doTest(fileName); + } + + @TestMetadata("misc3.kt") + public void testMisc3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/misc/misc3.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/super") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Super extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInSuper() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/super"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("multipleSuperTypes.kt") + public void testMultipleSuperTypes() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/super/multipleSuperTypes.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass1.kt") + public void testQualifiedByClass1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/super/qualifiedByClass1.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass2.kt") + public void testQualifiedByClass2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/super/qualifiedByClass2.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass3.kt") + public void testQualifiedByClass3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/super/qualifiedByClass3.kt"); + doTest(fileName); + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/expressions/this") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class This extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInThis() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/expressions/this"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("anonymousObjects.kt") + public void testAnonymousObjects() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/anonymousObjects.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass1.kt") + public void testQualifiedByClass1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByClass1.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass2.kt") + public void testQualifiedByClass2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByClass2.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByClass3.kt") + public void testQualifiedByClass3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByClass3.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByFunction1.kt") + public void testQualifiedByFunction1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction1.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByFunction2.kt") + public void testQualifiedByFunction2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction2.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedByFunction3.kt") + public void testQualifiedByFunction3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/qualifiedByFunction3.kt"); + doTest(fileName); + } + + @TestMetadata("simpleThis1.kt") + public void testSimpleThis1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/simpleThis1.kt"); + doTest(fileName); + } + + @TestMetadata("simpleThis2.kt") + public void testSimpleThis2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/expressions/this/simpleThis2.kt"); + doTest(fileName); + } + + } + + } + + @TestMetadata("idea/testData/unifier/equivalence/types") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class Types extends AbstractJetPsiUnifierTest { + public void testAllFilesPresentInTypes() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/unifier/equivalence/types"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("function0.kt") + public void testFunction0() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/function0.kt"); + doTest(fileName); + } + + @TestMetadata("function1.kt") + public void testFunction1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/function1.kt"); + doTest(fileName); + } + + @TestMetadata("function2.kt") + public void testFunction2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/function2.kt"); + doTest(fileName); + } + + @TestMetadata("nonNullable.kt") + public void testNonNullable() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/nonNullable.kt"); + doTest(fileName); + } + + @TestMetadata("nullable.kt") + public void testNullable() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/nullable.kt"); + doTest(fileName); + } + + @TestMetadata("userType.kt") + public void testUserType() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/unifier/equivalence/types/userType.kt"); + doTest(fileName); + } + + } + + } + +}