Resolve generic bounds of all classes prior to supertypes

This commit is contained in:
Alexander Udalov
2013-12-03 21:17:43 +04:00
parent 028274b934
commit 7af72b98fe
3 changed files with 17 additions and 2 deletions
@@ -209,13 +209,16 @@ public class TypeHierarchyResolver {
private void resolveTypesInClassHeaders() {
for (Map.Entry<JetClassOrObject, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
JetClassOrObject classOrObject = entry.getKey();
MutableClassDescriptor descriptor = entry.getValue();
if (classOrObject instanceof JetClass) {
MutableClassDescriptor descriptor = entry.getValue();
//noinspection unchecked
descriptorResolver.resolveGenericBounds((JetClass) classOrObject, descriptor.getScopeForSupertypeResolution(),
(List) descriptor.getTypeConstructor().getParameters(), trace);
}
descriptorResolver.resolveSupertypesForMutableClassDescriptor(classOrObject, descriptor, trace);
}
for (Map.Entry<JetClassOrObject, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
descriptorResolver.resolveSupertypesForMutableClassDescriptor(entry.getKey(), entry.getValue(), trace);
}
}
@@ -0,0 +1,7 @@
// Tests that generic bounds in the object supertype are resolved prior to the supertype itself
object O : Tr<V<*>>
trait Tr<T>
class V<out S>
@@ -2986,6 +2986,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/generics/RecursiveUpperBoundWithTwoArguments.kt");
}
@TestMetadata("resolveGenericBoundsBeforeSupertypes.kt")
public void testResolveGenericBoundsBeforeSupertypes() throws Exception {
doTest("compiler/testData/diagnostics/tests/generics/resolveGenericBoundsBeforeSupertypes.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/tpAsReified")
public static class TpAsReified extends AbstractDiagnosticsTestWithEagerResolve {
public void testAllFilesPresentInTpAsReified() throws Exception {