[NI] Add collecting forgotten type variables from callable references
#KT-35959 Fixed
This commit is contained in:
Generated
+5
@@ -1869,6 +1869,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35959.kt")
|
||||
public void testKt35959() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt35959.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
+4
-1
@@ -241,7 +241,10 @@ class KotlinConstraintSystemCompleter(
|
||||
fun ResolvedAtom.process(to: LinkedHashSet<TypeConstructor>) {
|
||||
val typeVariables = when (this) {
|
||||
is ResolvedCallAtom -> freshVariablesSubstitutor.freshVariables
|
||||
is CallableReferenceWithTypeVariableAsExpectedTypeAtom -> listOfNotNull(typeVariableForReturnType)
|
||||
is CallableReferenceWithTypeVariableAsExpectedTypeAtom -> mutableListOf<NewTypeVariable>().apply {
|
||||
addIfNotNull(typeVariableForReturnType)
|
||||
addAll(candidate?.freshSubstitutor?.freshVariables.orEmpty())
|
||||
}
|
||||
is ResolvedCallableReferenceAtom -> candidate?.freshSubstitutor?.freshVariables.orEmpty()
|
||||
is ResolvedLambdaAtom -> listOfNotNull(typeVariableForLambdaReturnType)
|
||||
else -> emptyList()
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-35959
|
||||
|
||||
interface Expect<T>
|
||||
|
||||
inline val <T> Expect<T>.and: Expect<T> get() = this
|
||||
infix fun <T> Expect<T>.and(assertionCreator: Expect<T>.() -> Unit): Expect<T> = this
|
||||
|
||||
fun <K> id(x: K): K = x
|
||||
|
||||
fun test(): Expect<Int>.(Expect<Int>.() -> Unit) -> Expect<Int> = id(Expect<Int>::and)
|
||||
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-35959
|
||||
|
||||
interface Expect<T>
|
||||
|
||||
inline val <T> Expect<T>.and: Expect<T> get() = this
|
||||
infix fun <T> Expect<T>.and(assertionCreator: Expect<T>.() -> Unit): Expect<T> = this
|
||||
|
||||
fun <K> id(x: K): K = x
|
||||
|
||||
fun test(): Expect<Int>.(Expect<Int>.() -> Unit) -> Expect<Int> = id(Expect<Int>::and)
|
||||
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> Expect<T>.and: Expect<T>
|
||||
public fun </*0*/ K> id(/*0*/ x: K): K
|
||||
public fun test(): Expect<kotlin.Int>.(Expect<kotlin.Int>.() -> kotlin.Unit) -> Expect<kotlin.Int>
|
||||
public infix fun </*0*/ T> Expect<T>.and(/*0*/ assertionCreator: Expect<T>.() -> kotlin.Unit): Expect<T>
|
||||
|
||||
public interface Expect</*0*/ T> {
|
||||
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1876,6 +1876,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35959.kt")
|
||||
public void testKt35959() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt35959.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
Generated
+5
@@ -1871,6 +1871,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35959.kt")
|
||||
public void testKt35959() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt35959.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
Reference in New Issue
Block a user