Provide implicit receiver to extension property initializer

This is safe because initializers for extension properties are forbidden
anyway, we'll just won't be generating noisy error messages about non-existent
'this'
This commit is contained in:
Alexander Udalov
2014-05-29 20:51:01 +04:00
parent a78b7fb31f
commit 796912bfcb
2 changed files with 8 additions and 7 deletions
@@ -21,7 +21,6 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -937,11 +936,13 @@ public class DescriptorResolver {
}
}
ReceiverParameterDescriptor receiverDescriptor = DescriptorFactory.createReceiverParameterForCallable(propertyDescriptor,
receiverType);
ReceiverParameterDescriptor receiverDescriptor =
DescriptorFactory.createReceiverParameterForCallable(propertyDescriptor, receiverType);
ReceiverParameterDescriptor implicitInitializerReceiver = property.hasDelegate() ? NO_RECEIVER_PARAMETER : receiverDescriptor;
JetScope propertyScope = JetScopeUtils.getPropertyDeclarationInnerScope(propertyDescriptor, scope, typeParameterDescriptors,
NO_RECEIVER_PARAMETER, trace);
implicitInitializerReceiver, trace);
JetType type = getVariableType(propertyDescriptor, propertyScope, property, dataFlowInfo, true, trace);
@@ -1,10 +1,10 @@
package i
val <T> List<T>.length = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!><!UNRESOLVED_REFERENCE!>size<!>()<!>
val <T> List<T>.length = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!>size()<!>
val <T> List<T>.length1 : Int get() = size()
val String.bd = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!><!NO_THIS!>this<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> "!"<!>
val String.bd = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!>this + "!"<!>
val String.bd1 : String get() = this + "!"
@@ -13,7 +13,7 @@ class A {
val ii : Int = 1
}
val A.foo = <!UNRESOLVED_REFERENCE, EXTENSION_PROPERTY_WITH_BACKING_FIELD!>ii<!>
val A.foo = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!>ii<!>
val A.foo1 : Int get() = ii