KT-8530 Synthetic properties doesn't work with smart casts

#KT-8530 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-07-17 15:13:39 +03:00
parent b6027a0efe
commit 23cfe88b71
19 changed files with 229 additions and 71 deletions
@@ -47,12 +47,12 @@ public abstract class AbstractScopeAdapter : JetScope {
return workerScope.getProperties(name)
}
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverType, name)
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverTypes, name)
}
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverType)
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverTypes)
}
override fun getLocalVariable(name: Name): VariableDescriptor? {
@@ -65,11 +65,11 @@ public open class ChainedScope(
override fun getFunctions(name: Name): Collection<FunctionDescriptor>
= getFromAllScopes { it.getFunctions(name) }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverType, name) }
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes, name) }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverType) }
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes) }
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
if (implicitReceiverHierarchy == null) {
@@ -37,9 +37,9 @@ public class FilteringScope(private val workerScope: JetScope, private val predi
override fun getProperties(name: Name) = workerScope.getProperties(name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverType, name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverTypes, name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverType).filter(predicate)
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverTypes).filter(predicate)
override fun getLocalVariable(name: Name) = filterDescriptor(workerScope.getLocalVariable(name))
@@ -35,9 +35,9 @@ public trait JetScope {
public fun getFunctions(name: Name): Collection<FunctionDescriptor>
public fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor>
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor>
public fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor>
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor>
public fun getContainingDeclaration(): DeclarationDescriptor
@@ -32,9 +32,9 @@ public abstract class JetScopeImpl : JetScope {
override fun getFunctions(name: Name): Collection<FunctionDescriptor> = setOf()
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = listOf()
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = listOf()
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = listOf()
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor> = listOf()
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> = listOf()
@@ -70,9 +70,9 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
override fun getFunctions(name: Name) = substitute(workerScope.getFunctions(name))
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverType, name))
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name))
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverType))
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes))
override fun getPackage(name: Name) = workerScope.getPackage(name)
@@ -94,14 +94,14 @@ public class ErrorUtils {
@NotNull
@Override
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
@NotNull JetType receiverType, @NotNull Name name
@NotNull Collection<? extends JetType> receiverTypes, @NotNull Name name
) {
return ERROR_PROPERTY_GROUP;
}
@NotNull
@Override
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) {
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends JetType> receiverTypes) {
return ERROR_PROPERTY_GROUP;
}
@@ -210,14 +210,14 @@ public class ErrorUtils {
@NotNull
@Override
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
@NotNull JetType receiverType, @NotNull Name name
@NotNull Collection<? extends JetType> receiverTypes, @NotNull Name name
) {
throw new IllegalStateException();
}
@NotNull
@Override
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) {
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends JetType> receiverTypes) {
throw new IllegalStateException();
}