[NI] Fix input/output types for callable reference atom
Input and output types are crucial for type variable fixation order and analysis of postponed arguments (callable references, lambdas). Specifically, if there is non-fixed type variable inside input types of a callable reference, then we'll postpone resolution for such callable reference. Initial example with the expected type `KMutableProperty1<*, F>` caused problems because input types were computed incorrectly (while there aren't input types here) #KT-25431 Fixed
This commit is contained in:
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
interface Parent
|
||||
class Child : Parent
|
||||
|
||||
class ChildHolder(var child: Child)
|
||||
|
||||
interface Inv<T>
|
||||
|
||||
class Form {
|
||||
fun <F> get0(field: KMutableProperty<F>): Inv<F> = TODO()
|
||||
fun <F> get1(field: KProperty<F>): Inv<F> = TODO()
|
||||
fun <F> get2(field: KCallable<F>): Inv<F> = TODO()
|
||||
fun <F> get3(field: KMutableProperty1<*, F>): Inv<F> = TODO()
|
||||
}
|
||||
|
||||
fun <T : Parent> radio(field: Inv<T>) {}
|
||||
|
||||
fun test(form: Form) {
|
||||
radio(form.get0(ChildHolder::child))
|
||||
radio(form.get1(ChildHolder::child))
|
||||
radio(form.get2(ChildHolder::child))
|
||||
radio(form.get3(ChildHolder::child))
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T : Parent> radio(/*0*/ field: Inv<T>): kotlin.Unit
|
||||
public fun test(/*0*/ form: Form): kotlin.Unit
|
||||
|
||||
public final class Child : Parent {
|
||||
public constructor Child()
|
||||
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
|
||||
}
|
||||
|
||||
public final class ChildHolder {
|
||||
public constructor ChildHolder(/*0*/ child: Child)
|
||||
public final var child: Child
|
||||
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
|
||||
}
|
||||
|
||||
public final class Form {
|
||||
public constructor Form()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ F> get0(/*0*/ field: kotlin.reflect.KMutableProperty<F>): Inv<F>
|
||||
public final fun </*0*/ F> get1(/*0*/ field: kotlin.reflect.KProperty<F>): Inv<F>
|
||||
public final fun </*0*/ F> get2(/*0*/ field: kotlin.reflect.KCallable<F>): Inv<F>
|
||||
public final fun </*0*/ F> get3(/*0*/ field: kotlin.reflect.KMutableProperty1<*, F>): Inv<F>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Inv</*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
|
||||
}
|
||||
|
||||
public interface Parent {
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user