FIR: Fix overridability of Kotlin vararg from Java
This commit is contained in:
+6
@@ -17991,6 +17991,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
public void testTypeParameter() throws Exception {
|
public void testTypeParameter() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("varargOverride.kt")
|
||||||
|
public void testVarargOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/types/varargOverride.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
@@ -17991,6 +17991,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
public void testTypeParameter() throws Exception {
|
public void testTypeParameter() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("varargOverride.kt")
|
||||||
|
public void testVarargOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/types/varargOverride.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
@@ -17991,6 +17991,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
public void testTypeParameter() throws Exception {
|
public void testTypeParameter() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("varargOverride.kt")
|
||||||
|
public void testVarargOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/types/varargOverride.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
): Boolean =
|
): Boolean =
|
||||||
when {
|
when {
|
||||||
candidateTypeProjection is ConeKotlinTypeProjection && baseTypeProjection is ConeKotlinTypeProjection ->
|
candidateTypeProjection is ConeKotlinTypeProjection && baseTypeProjection is ConeKotlinTypeProjection ->
|
||||||
candidateTypeProjection.kind == baseTypeProjection.kind &&
|
isEqualTypes(candidateTypeProjection.type, baseTypeProjection.type, substitutor)
|
||||||
isEqualTypes(candidateTypeProjection.type, baseTypeProjection.type, substitutor)
|
|
||||||
candidateTypeProjection is ConeStarProjection && baseTypeProjection is ConeStarProjection -> true
|
candidateTypeProjection is ConeStarProjection && baseTypeProjection is ConeStarProjection -> true
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// FIR_IDENTICAL
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface A extends B {
|
||||||
|
void foo(@NotNull String... value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
interface B {
|
||||||
|
fun foo(vararg x: String) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(a: A) {
|
||||||
|
a.foo()
|
||||||
|
a.foo("1")
|
||||||
|
a.foo("2", "3")
|
||||||
|
}
|
||||||
Generated
+6
@@ -17997,6 +17997,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
public void testTypeParameter() throws Exception {
|
public void testTypeParameter() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/types/typeParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("varargOverride.kt")
|
||||||
|
public void testVarargOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/types/varargOverride.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user