First converting classifier, and then process arguments.

This commit is contained in:
Evgeny Gerashchenko
2012-11-22 14:56:18 +04:00
parent 4da03f75f9
commit a937d6be91
4 changed files with 18 additions and 19 deletions
@@ -140,18 +140,18 @@ public class SignaturesPropagation {
}
boolean resultNullable = typeMustBeNullable(autoType, typesFromSuper, covariantPosition, reportError);
List<TypeProjection> resultArguments = getTypeArgsOfType(autoType, typesFromSuper, reportError);
ClassifierDescriptor resultClassifier = modifyTypeClassifier(autoType, typesFromSuper);
List<TypeProjection> resultArguments = getTypeArgsOfType(autoType, resultClassifier, typesFromSuper, reportError);
JetScope resultScope;
ClassifierDescriptor classifierDescriptor = modifyTypeClassifier(autoType, typesFromSuper);
if (classifierDescriptor instanceof ClassDescriptor) {
resultScope = ((ClassDescriptor) classifierDescriptor).getMemberScope(resultArguments);
if (resultClassifier instanceof ClassDescriptor) {
resultScope = ((ClassDescriptor) resultClassifier).getMemberScope(resultArguments);
}
else {
resultScope = autoType.getMemberScope();
}
return new JetTypeImpl(autoType.getAnnotations(),
classifierDescriptor.getTypeConstructor(),
resultClassifier.getTypeConstructor(),
resultNullable,
resultArguments,
resultScope);
@@ -160,11 +160,10 @@ public class SignaturesPropagation {
@NotNull
private static List<TypeProjection> getTypeArgsOfType(
@NotNull JetType autoType,
@NotNull ClassifierDescriptor classifier,
@NotNull List<JetType> typesFromSuper,
@NotNull Function1<String, Void> reportError
) {
TypeConstructor typeConstructor = autoType.getConstructor();
ClassifierDescriptor classifier = typeConstructor.getDeclarationDescriptor();
List<TypeProjection> autoArguments = autoType.getArguments();
if (!(classifier instanceof ClassDescriptor)) {
@@ -177,7 +176,7 @@ public class SignaturesPropagation {
// Modify type arguments using info from typesFromSuper
List<TypeProjection> resultArguments = Lists.newArrayList();
for (TypeParameterDescriptor parameter : typeConstructor.getParameters()) {
for (TypeParameterDescriptor parameter : classifier.getTypeConstructor().getParameters()) {
TypeProjection argument = autoArguments.get(parameter.getIndex());
TypeCheckingProcedure.EnrichedProjectionKind effectiveProjectionKind =
@@ -8,16 +8,16 @@ import jet.*;
public interface TwoSuperclassesSupplementNotNull {
public interface Super1 {
@KotlinSignature("fun foo(): Function0<String?>")
public Function0<String> foo();
@KotlinSignature("fun foo(): List<String?>")
public List<String> foo();
}
public interface Super2 {
@KotlinSignature("fun foo(): Function0<String>?")
public Function0<String> foo();
@KotlinSignature("fun foo(): List<String>?")
public List<String> foo();
}
public interface Sub extends Super1, Super2 {
public Function0<String> foo();
public List<String> foo();
}
}
@@ -3,14 +3,14 @@ package test
public trait TwoSuperclassesSupplementNotNull: Object {
public trait Super1: Object {
public fun foo(): Function0<String?>
public fun foo(): List<String?>
}
public trait Super2: Object {
public fun foo(): Function0<String>?
public fun foo(): List<String>?
}
public trait Sub: Super1, Super2 {
override fun foo(): Function0<String>
override fun foo(): List<String>
}
}
@@ -2,12 +2,12 @@ namespace test
public abstract trait test.TwoSuperclassesSupplementNotNull : java.lang.Object {
public abstract trait test.TwoSuperclassesSupplementNotNull.Sub : test.TwoSuperclassesSupplementNotNull.Super1, test.TwoSuperclassesSupplementNotNull.Super2 {
public abstract override /*2*/ fun foo(): jet.Function0<jet.String>
public abstract override /*2*/ fun foo(): jet.List<jet.String>
}
public abstract trait test.TwoSuperclassesSupplementNotNull.Super1 : java.lang.Object {
public abstract fun foo(): jet.Function0<jet.String?>
public abstract fun foo(): jet.List<jet.String?>
}
public abstract trait test.TwoSuperclassesSupplementNotNull.Super2 : java.lang.Object {
public abstract fun foo(): jet.Function0<jet.String>?
public abstract fun foo(): jet.List<jet.String>?
}
}