Fix ambiguity between Java and Kotlin SAM candidates
Because of incorrect flag we generated synthetic SAM candidates and got ambiguity when feature `SamConversionPerArgument` was enabled (Gradle case) because candidates for Java were duplicated #KT-35579 Fixed
This commit is contained in:
Generated
+5
@@ -18718,6 +18718,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||||
|
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleCorrect.kt")
|
@TestMetadata("SimpleCorrect.kt")
|
||||||
public void testSimpleCorrect() throws Exception {
|
public void testSimpleCorrect() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ class JavaSyntheticScopes(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
val samConversionPerArgumentIsEnabled =
|
val samConversionPerArgumentIsEnabled =
|
||||||
languageVersionSettings.supportsFeature(LanguageFeature.SamConversionPerArgument) &&
|
languageVersionSettings.supportsFeature(LanguageFeature.SamConversionPerArgument)
|
||||||
languageVersionSettings.supportsFeature(LanguageFeature.ProhibitVarargAsArrayAfterSamArgument)
|
|
||||||
|
|
||||||
val javaSyntheticPropertiesScope = JavaSyntheticPropertiesScope(storageManager, lookupTracker)
|
val javaSyntheticPropertiesScope = JavaSyntheticPropertiesScope(storageManager, lookupTracker)
|
||||||
val scopesFromExtensions = SyntheticScopeProviderExtension
|
val scopesFromExtensions = SyntheticScopeProviderExtension
|
||||||
|
|||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: Action.java
|
||||||
|
public interface Action<T> {
|
||||||
|
void execute(T t);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Other.java
|
||||||
|
|
||||||
|
// It's important that this is Java
|
||||||
|
public interface Other {
|
||||||
|
void pluginManagement(Action<? super Number> pluginManagementSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
interface B {
|
||||||
|
fun pluginManagement(block: Number.() -> Unit): Unit {}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C : B, Other
|
||||||
|
|
||||||
|
fun test(c: C) {
|
||||||
|
c.<!AMBIGUITY!>pluginManagement<!> {
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: Action.java
|
||||||
|
public interface Action<T> {
|
||||||
|
void execute(T t);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Other.java
|
||||||
|
|
||||||
|
// It's important that this is Java
|
||||||
|
public interface Other {
|
||||||
|
void pluginManagement(Action<? super Number> pluginManagementSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
interface B {
|
||||||
|
fun pluginManagement(block: Number.() -> Unit): Unit {}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C : B, Other
|
||||||
|
|
||||||
|
fun test(c: C) {
|
||||||
|
c.pluginManagement {
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ c: C): kotlin.Unit
|
||||||
|
|
||||||
|
public interface Action</*0*/ T : kotlin.Any!> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun execute(/*0*/ t: T!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface B {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun pluginManagement(/*0*/ block: kotlin.Number.() -> kotlin.Unit): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface C : B, Other {
|
||||||
|
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun pluginManagement(/*0*/ pluginManagementSpec: Action<in kotlin.Number!>!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun pluginManagement(/*0*/ block: kotlin.Number.() -> kotlin.Unit): kotlin.Unit
|
||||||
|
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Other {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract fun pluginManagement(/*0*/ pluginManagementSpec: Action<in kotlin.Number!>!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -18730,6 +18730,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||||
|
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleCorrect.kt")
|
@TestMetadata("SimpleCorrect.kt")
|
||||||
public void testSimpleCorrect() throws Exception {
|
public void testSimpleCorrect() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
||||||
|
|||||||
Generated
+5
@@ -18720,6 +18720,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||||
|
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleCorrect.kt")
|
@TestMetadata("SimpleCorrect.kt")
|
||||||
public void testSimpleCorrect() throws Exception {
|
public void testSimpleCorrect() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user