Update test data for tower resolution algorithm
- locals win - unary calls to plus/minus are not supported in favor of unaryPlus/unaryMinus - unqualified nested classes are temporarily reported as unresolved - function without receiver win against extension function - explicit import win against star import
This commit is contained in:
committed by
Stanislav Erokhin
parent
66a031f7a0
commit
239502368a
+7
-6
@@ -1,10 +1,11 @@
|
||||
object A {
|
||||
class B
|
||||
fun foo() = 1
|
||||
object Bar{}
|
||||
class B
|
||||
fun foo() = 1
|
||||
object Bar {}
|
||||
}
|
||||
|
||||
fun <T> test(a: T) {
|
||||
val c = (a as A)
|
||||
c.<error descr="[NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE] Nested class 'B' accessed via instance reference">B</error>()
|
||||
}
|
||||
val c = (a as A)
|
||||
// TODO: report "nested class accessed via instance reference"
|
||||
c.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: B">B</error>()
|
||||
}
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
// ERROR: Overload resolution ambiguity: public fun a.A.ext(): kotlin.Unit defined in a public fun a.A.ext(): kotlin.Unit defined in to
|
||||
// ERROR: Overload resolution ambiguity: public var a.A.p: kotlin.Int defined in a public var a.A.p: kotlin.Int defined in to
|
||||
// ERROR: Overload resolution ambiguity: public var a.A.p: kotlin.Int defined in a public var a.A.p: kotlin.Int defined in to
|
||||
package to
|
||||
|
||||
import a.A
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
// ERROR: Overload resolution ambiguity: public fun a.A.ext(): kotlin.Unit defined in a public fun a.A.ext(): kotlin.Unit defined in to
|
||||
// ERROR: Overload resolution ambiguity: public operator fun a.A.plus(a: a.A): kotlin.Unit defined in a public operator fun a.A.plus(a: a.A): kotlin.Unit defined in to
|
||||
// ERROR: Overload resolution ambiguity: public infix fun a.A.infix(a: a.A): kotlin.Unit defined in a public infix fun a.A.infix(a: a.A): kotlin.Unit defined in to
|
||||
// ERROR: Overload resolution ambiguity: public operator fun a.A.unaryMinus(): kotlin.Unit defined in a public operator fun a.A.unaryMinus(): kotlin.Unit defined in to
|
||||
// ERROR: Overload resolution ambiguity: public val a.A.p: kotlin.Int defined in a public val a.A.p: kotlin.Int defined in to
|
||||
package to
|
||||
|
||||
import a.A
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
// ERROR: Nested class 'Nested' should be qualified as 'A.Nested'
|
||||
package to
|
||||
|
||||
import a.A
|
||||
import a.ext
|
||||
import a.f
|
||||
|
||||
fun g() {
|
||||
f {
|
||||
Inner()
|
||||
Nested()
|
||||
A.Nested()
|
||||
foo()
|
||||
ext()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS_NUMBER: 4
|
||||
// !DIAGNOSTICS_NUMBER: 3
|
||||
// !DIAGNOSTICS: NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE
|
||||
|
||||
class A {
|
||||
@@ -9,8 +9,8 @@ class A {
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
a.Nested()
|
||||
a.NestedWithClassObject
|
||||
a.NestedEnum
|
||||
a.NestedObj
|
||||
}
|
||||
a.Nested() // TODO: report "nested class accessed via instance reference" here as well
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
<!-- nestedClassAcessedViaInstanceReference1 -->
|
||||
Nested class 'Nested' accessed via instance reference
|
||||
Nested class 'NestedWithClassObject' accessed via instance reference
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
<!-- nestedClassAcessedViaInstanceReference2 -->
|
||||
Nested companion object 'Companion' accessed via instance reference
|
||||
Nested enum class 'NestedEnum' accessed via instance reference
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
<!-- nestedClassAcessedViaInstanceReference3 -->
|
||||
Nested enum class 'NestedEnum' accessed via instance reference
|
||||
Nested object 'NestedObj' accessed via instance reference
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
<!-- nestedClassAcessedViaInstanceReference4 -->
|
||||
Nested object 'NestedObj' accessed via instance reference
|
||||
Nested class 'Nested' accessed via instance reference
|
||||
@@ -1,6 +1,8 @@
|
||||
// !DIAGNOSTICS_NUMBER: 5
|
||||
// !DIAGNOSTICS_NUMBER: 0
|
||||
// !DIAGNOSTICS: NESTED_CLASS_SHOULD_BE_QUALIFIED
|
||||
|
||||
// TODO: 5 "nested class should be qualified" dianostics should be reported here
|
||||
|
||||
package p
|
||||
|
||||
class A {
|
||||
|
||||
@@ -2,5 +2,4 @@ Function call (10: 17) A(0) + A(1) + 2
|
||||
Function call (11: 20) A(0) plus A(1) plus 2
|
||||
Function call (12: 20) A(0).plus(A(1).plus(2))
|
||||
Function call (15: 7) a += 1
|
||||
Function call (6: 30) fun plus(a: A): A = this + a.n
|
||||
Unclassified usage (18: 5) +A(0)
|
||||
Function call (6: 30) fun plus(a: A): A = this + a.n
|
||||
@@ -6,7 +6,7 @@ public fun String.infixMessage(@PropertyKey(resourceBundle = "idea.testData.find
|
||||
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.infixMessage2(s: String) = this
|
||||
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.minus() = this
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.unaryMinus() = this
|
||||
|
||||
public fun Int.get(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = this
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package a
|
||||
|
||||
import java.lang.AssertionError
|
||||
|
||||
fun foo() {
|
||||
if (!true) {
|
||||
throw AssertionError("text")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// PARAM_DESCRIPTOR: value-parameter val plus: kotlin.String.() -> kotlin.Unit defined in foo
|
||||
// PARAM_DESCRIPTOR: value-parameter val unaryPlus: kotlin.String.() -> kotlin.Unit defined in foo
|
||||
// PARAM_TYPES: kotlin.String.() -> kotlin.Unit
|
||||
|
||||
fun foo(plus: String.() -> Unit) {
|
||||
fun foo(unaryPlus: String.() -> Unit) {
|
||||
<selection>+</selection> "A"
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
// PARAM_DESCRIPTOR: value-parameter val plus: kotlin.String.() -> kotlin.Unit defined in foo
|
||||
// PARAM_DESCRIPTOR: value-parameter val unaryPlus: kotlin.String.() -> kotlin.Unit defined in foo
|
||||
// PARAM_TYPES: kotlin.String.() -> kotlin.Unit
|
||||
|
||||
fun foo(plus: String.() -> Unit) {
|
||||
fun foo(unaryPlus: String.() -> Unit) {
|
||||
"A".(function(plus))()
|
||||
}
|
||||
|
||||
private fun function(plus: String.() -> Unit) = plus
|
||||
private fun function(unaryPlus: String.() -> Unit) = unaryPlus
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ fun main(args : Array<String>) {
|
||||
var a = <caret>IntArray(array(1, 2, 3))
|
||||
}
|
||||
|
||||
// REF: (in kotlin.IntArray).IntArray(Int)
|
||||
// REF: (ctrl_click).IntArray(Int)
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import junit.framework.ComparisonFailure;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil;
|
||||
@@ -39,7 +40,6 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ComparisonFailure;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -178,7 +178,7 @@ public abstract class AbstractIntentionTest extends KotlinCodeInsightTestCase {
|
||||
checkResultByFile(canonicalPathToExpectedFile);
|
||||
}
|
||||
catch (ComparisonFailure e) {
|
||||
KotlinTestUtils.assertEqualsToFile(new File(canonicalPathToExpectedFile), getEditor());
|
||||
KotlinTestUtils.assertEqualsToFile(new File(canonicalPathToExpectedFile), getEditor().getDocument().getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user