Create From Usage: Fix type substitution for no-receiver calls
This commit is contained in:
+3
-1
@@ -223,9 +223,9 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
val placement = placement
|
val placement = placement
|
||||||
when {
|
when {
|
||||||
placement is CallablePlacement.NoReceiver -> {
|
placement is CallablePlacement.NoReceiver -> {
|
||||||
receiverClassDescriptor = null
|
|
||||||
isExtension = false
|
isExtension = false
|
||||||
containingElement = placement.containingElement
|
containingElement = placement.containingElement
|
||||||
|
receiverClassDescriptor = (containingElement as? JetClassOrObject)?.let { currentFileContext[BindingContext.CLASS, it] }
|
||||||
}
|
}
|
||||||
placement is CallablePlacement.WithReceiver -> {
|
placement is CallablePlacement.WithReceiver -> {
|
||||||
receiverClassDescriptor =
|
receiverClassDescriptor =
|
||||||
@@ -293,6 +293,8 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
receiverType: JetType?,
|
receiverType: JetType?,
|
||||||
result: MutableMap<JetType, JetType>
|
result: MutableMap<JetType, JetType>
|
||||||
) {
|
) {
|
||||||
|
if (placement is CallablePlacement.NoReceiver) return
|
||||||
|
|
||||||
val classTypeParameters = receiverType?.getArguments() ?: Collections.emptyList()
|
val classTypeParameters = receiverType?.getArguments() ?: Collections.emptyList()
|
||||||
val ownerTypeArguments = (placement as? CallablePlacement.WithReceiver)?.receiverTypeCandidate?.theType?.getArguments()
|
val ownerTypeArguments = (placement as? CallablePlacement.WithReceiver)?.receiverTypeCandidate?.theType?.getArguments()
|
||||||
?: Collections.emptyList()
|
?: Collections.emptyList()
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import kotlin.properties.ReadOnlyProperty
|
|||||||
class A<T>(val t: T) {
|
class A<T>(val t: T) {
|
||||||
val x: A<Int> by foo(t, "")
|
val x: A<Int> by foo(t, "")
|
||||||
|
|
||||||
fun <T> foo(t: T, s: String): ReadOnlyProperty<A<T>, A<Int>> {
|
fun foo(t: T, s: String): ReadOnlyProperty<A<T>, A<Int>> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import kotlin.properties.ReadWriteProperty
|
|||||||
class A<T>(val t: T) {
|
class A<T>(val t: T) {
|
||||||
var x: A<Int> by foo(t, "")
|
var x: A<Int> by foo(t, "")
|
||||||
|
|
||||||
fun <T> foo(t: T, s: String): ReadWriteProperty<A<T>, A<Int>> {
|
fun foo(t: T, s: String): ReadWriteProperty<A<T>, A<Int>> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
|
|
||||||
class A<T> {
|
class A<T> {
|
||||||
val <T> foo: ReadOnlyProperty<A<T>, A<Int>>
|
val foo: ReadOnlyProperty<A<T>, A<Int>>
|
||||||
|
|
||||||
val x: A<Int> by foo
|
val x: A<Int> by foo
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
import kotlin.properties.ReadWriteProperty
|
import kotlin.properties.ReadWriteProperty
|
||||||
|
|
||||||
class A<T> {
|
class A<T> {
|
||||||
val <T> foo: ReadWriteProperty<A<T>, A<Int>>
|
val foo: ReadWriteProperty<A<T>, A<Int>>
|
||||||
|
|
||||||
var x: A<Int> by foo
|
var x: A<Int> by foo
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user