diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java index cfbc80a03e3..2f8f9fb8945 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java @@ -234,17 +234,7 @@ public class SignaturesPropagationData { assert superFun instanceof FunctionDescriptor : superFun.getClass().getName(); - DeclarationDescriptor superFunContainer = superFun.getContainingDeclaration(); - assert superFunContainer instanceof ClassDescriptor: superFunContainer; - - JetType supertype = superclassToSupertype.get(superFunContainer); - assert supertype != null : "Couldn't find super type for super function: " + superFun; - TypeSubstitutor supertypeSubstitutor = TypeSubstitutor.create(supertype); - - FunctionDescriptor substitutedSuperFun = ((FunctionDescriptor) superFun).substitute(supertypeSubstitutor); - assert substitutedSuperFun != null; - - superFunctions.add(substitutedSuperFun); + superFunctions.add(substituteSuperFunction(superclassToSupertype, (FunctionDescriptor) superFun)); } // sorting for diagnostic stability @@ -663,6 +653,23 @@ public class SignaturesPropagationData { return superclassToSupertype; } + @NotNull + private static FunctionDescriptor substituteSuperFunction( + @NotNull Map superclassToSupertype, + @NotNull FunctionDescriptor superFun + ) { + DeclarationDescriptor superFunContainer = superFun.getContainingDeclaration(); + assert superFunContainer instanceof ClassDescriptor: superFunContainer; + + JetType supertype = superclassToSupertype.get(superFunContainer); + assert supertype != null : "Couldn't find super type for super function: " + superFun; + TypeSubstitutor supertypeSubstitutor = TypeSubstitutor.create(supertype); + + FunctionDescriptor substitutedSuperFun = superFun.substitute(supertypeSubstitutor); + assert substitutedSuperFun != null; + return substitutedSuperFun; + } + private static boolean isArrayType(@NotNull JetType type) { KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance(); return builtIns.isArray(type) || builtIns.isPrimitiveArray(type);