First converting classifier, and then process arguments.
This commit is contained in:
+7
-8
@@ -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 =
|
||||
|
||||
+5
-5
@@ -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
-3
@@ -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>
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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>?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user