Resolve generic bounds of all classes prior to supertypes
This commit is contained in:
@@ -209,13 +209,16 @@ public class TypeHierarchyResolver {
|
|||||||
private void resolveTypesInClassHeaders() {
|
private void resolveTypesInClassHeaders() {
|
||||||
for (Map.Entry<JetClassOrObject, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
for (Map.Entry<JetClassOrObject, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
||||||
JetClassOrObject classOrObject = entry.getKey();
|
JetClassOrObject classOrObject = entry.getKey();
|
||||||
MutableClassDescriptor descriptor = entry.getValue();
|
|
||||||
if (classOrObject instanceof JetClass) {
|
if (classOrObject instanceof JetClass) {
|
||||||
|
MutableClassDescriptor descriptor = entry.getValue();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
descriptorResolver.resolveGenericBounds((JetClass) classOrObject, descriptor.getScopeForSupertypeResolution(),
|
descriptorResolver.resolveGenericBounds((JetClass) classOrObject, descriptor.getScopeForSupertypeResolution(),
|
||||||
(List) descriptor.getTypeConstructor().getParameters(), trace);
|
(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");
|
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")
|
@TestMetadata("compiler/testData/diagnostics/tests/generics/tpAsReified")
|
||||||
public static class TpAsReified extends AbstractDiagnosticsTestWithEagerResolve {
|
public static class TpAsReified extends AbstractDiagnosticsTestWithEagerResolve {
|
||||||
public void testAllFilesPresentInTpAsReified() throws Exception {
|
public void testAllFilesPresentInTpAsReified() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user