diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt index 1aeb53d6e2f..2d1f31f338a 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt @@ -223,9 +223,9 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { val placement = placement when { placement is CallablePlacement.NoReceiver -> { - receiverClassDescriptor = null isExtension = false containingElement = placement.containingElement + receiverClassDescriptor = (containingElement as? JetClassOrObject)?.let { currentFileContext[BindingContext.CLASS, it] } } placement is CallablePlacement.WithReceiver -> { receiverClassDescriptor = @@ -293,6 +293,8 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { receiverType: JetType?, result: MutableMap ) { + if (placement is CallablePlacement.NoReceiver) return + val classTypeParameters = receiverType?.getArguments() ?: Collections.emptyList() val ownerTypeArguments = (placement as? CallablePlacement.WithReceiver)?.receiverTypeCandidate?.theType?.getArguments() ?: Collections.emptyList() diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberValDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberValDelegateRuntime.kt index 3247ba61116..40c9d0b4bcd 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberValDelegateRuntime.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberValDelegateRuntime.kt @@ -5,7 +5,7 @@ import kotlin.properties.ReadOnlyProperty class A(val t: T) { val x: A by foo(t, "") - fun foo(t: T, s: String): ReadOnlyProperty, A> { + fun foo(t: T, s: String): ReadOnlyProperty, A> { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberVarDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberVarDelegateRuntime.kt index e0cf488ec55..d7357222670 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberVarDelegateRuntime.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/afterMemberVarDelegateRuntime.kt @@ -5,7 +5,7 @@ import kotlin.properties.ReadWriteProperty class A(val t: T) { var x: A by foo(t, "") - fun foo(t: T, s: String): ReadWriteProperty, A> { + fun foo(t: T, s: String): ReadWriteProperty, A> { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberValDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberValDelegateRuntime.kt index 68ada12997a..9ff3c64a993 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberValDelegateRuntime.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberValDelegateRuntime.kt @@ -5,7 +5,7 @@ import kotlin.properties.ReadOnlyProperty class A { - val foo: ReadOnlyProperty, A> + val foo: ReadOnlyProperty, A> val x: A by foo } diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberVarDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberVarDelegateRuntime.kt index f12fe45cc61..ab9238f0c51 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberVarDelegateRuntime.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/afterMemberVarDelegateRuntime.kt @@ -5,7 +5,7 @@ import kotlin.properties.ReadWriteProperty class A { - val foo: ReadWriteProperty, A> + val foo: ReadWriteProperty, A> var x: A by foo }