Rework TypeSubstituion, now it applies to types instead of constructors

Also introduce IndexedParametersSubstitution
This commit is contained in:
Denis Zharkov
2015-07-27 19:07:01 +03:00
parent 1aef9b77f1
commit a07a1829c5
22 changed files with 108 additions and 171 deletions
@@ -141,6 +141,7 @@ public class JavaResolverUtils {
typeSubstitutionContext.put(originalToAltTypeParameter.getKey().getTypeConstructor(),
new TypeProjectionImpl(originalToAltTypeParameter.getValue().getDefaultType()));
}
// TODO: Use IndexedParametersSubstitution here instead of map creation
return TypeSubstitutor.create(typeSubstitutionContext);
}
}
@@ -271,7 +271,7 @@ class JavaSyntheticExtensionsScope(storageManager: StorageManager) : JetScope by
init {
val classTypeParams = ownerClass.typeConstructor.parameters
val typeParameters = ArrayList<TypeParameterDescriptor>(classTypeParams.size())
val typeSubstitutor = DescriptorSubstitutor.substituteTypeParameters(classTypeParams, TypeSubstitutor.EMPTY, this, typeParameters)
val typeSubstitutor = DescriptorSubstitutor.substituteTypeParameters(classTypeParams, TypeSubstitution.EMPTY, this, typeParameters)
val propertyType = typeSubstitutor.safeSubstitute(type, Variance.INVARIANT)
val receiverType = typeSubstitutor.safeSubstitute(ownerClass.defaultType, Variance.INVARIANT)