[NI] Fix expicit super receiver check
^KT-37497 Fixed
This commit is contained in:
+5
@@ -2418,6 +2418,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
|||||||
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt-37497.kt")
|
||||||
|
public void testKt_37497() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt-37497.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class KotlinResolutionStatelessCallbacksImpl(
|
|||||||
descriptor,
|
descriptor,
|
||||||
(kotlinCall as? PSIKotlinCall)?.psiCall,
|
(kotlinCall as? PSIKotlinCall)?.psiCall,
|
||||||
(resolutionCallbacks as? KotlinResolutionCallbacksImpl)?.trace?.bindingContext,
|
(resolutionCallbacks as? KotlinResolutionCallbacksImpl)?.trace?.bindingContext,
|
||||||
isSuperOrDelegatingConstructorCall(kotlinCall),
|
kotlinCall is PSIKotlinCallImpl && kotlinCall.psiCall.isCallWithSuperReceiver(),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun isSuperExpression(receiver: SimpleKotlinCallArgument?): Boolean =
|
override fun isSuperExpression(receiver: SimpleKotlinCallArgument?): Boolean =
|
||||||
|
|||||||
+2
-1
@@ -601,7 +601,8 @@ internal fun createPreviousResolveError(status: ResolutionStatus): PreviousResol
|
|||||||
return PreviousResolutionError(level)
|
return PreviousResolutionError(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val BasicCallResolutionContext.isSuperCall: Boolean get() = call.explicitReceiver is SuperCallReceiverValue
|
internal fun Call.isCallWithSuperReceiver(): Boolean = explicitReceiver is SuperCallReceiverValue
|
||||||
|
private val BasicCallResolutionContext.isSuperCall: Boolean get() = call.isCallWithSuperReceiver()
|
||||||
|
|
||||||
internal fun reportResolvedUsingDeprecatedVisibility(
|
internal fun reportResolvedUsingDeprecatedVisibility(
|
||||||
call: Call,
|
call: Call,
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// FULL_JDK
|
||||||
|
// Issue: KT-37497
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
object Bug1 {
|
||||||
|
@JvmStatic
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val list = object : ArrayList<String>(listOf("a")) {
|
||||||
|
override fun sort(c: Comparator<in String>?) {
|
||||||
|
super.sort(c)
|
||||||
|
println(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public object Bug1 {
|
||||||
|
private constructor Bug1()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
@kotlin.jvm.JvmStatic public final fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// !WITH_NEW_INFERENCE
|
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|
||||||
abstract class A : MutableList<String> {
|
abstract class A : MutableList<String> {
|
||||||
|
|||||||
+1
-2
@@ -1,9 +1,8 @@
|
|||||||
// !WITH_NEW_INFERENCE
|
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|
||||||
abstract class A : MutableList<String> {
|
abstract class A : MutableList<String> {
|
||||||
override fun sort(/*0*/ p0: java.util.Comparator<in String>) {
|
override fun sort(/*0*/ p0: java.util.Comparator<in String>) {
|
||||||
<!NI;SUPER_CANT_BE_EXTENSION_RECEIVER!>super<!>.<!NI;DEPRECATION_ERROR, OI;DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>sort<!>(p0)
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>sort<!>(p0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -3423,6 +3423,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
|||||||
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt-37497.kt")
|
||||||
|
public void testKt_37497() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt-37497.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
||||||
|
|||||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -3423,6 +3423,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
|||||||
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
public void testKt9820_javaFunctionTypeInheritor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9820_javaFunctionTypeInheritor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt-37497.kt")
|
||||||
|
public void testKt_37497() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt-37497.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified")
|
||||||
|
|||||||
Reference in New Issue
Block a user