KT-939 CommonSupertypes erases scopes associated to types
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -153,7 +156,12 @@ public class CommonSupertypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : attributes?
|
// TODO : attributes?
|
||||||
return new JetTypeImpl(Collections.<AnnotationDescriptor>emptyList(), constructor, nullable, newProjections, JetStandardClasses.STUB); // TODO : scope
|
JetScope newScope = JetStandardClasses.STUB;
|
||||||
|
DeclarationDescriptor declarationDescriptor = constructor.getDeclarationDescriptor();
|
||||||
|
if (declarationDescriptor instanceof ClassDescriptor) {
|
||||||
|
newScope = ((ClassDescriptor) declarationDescriptor).getMemberScope(newProjections);
|
||||||
|
}
|
||||||
|
return new JetTypeImpl(Collections.<AnnotationDescriptor>emptyList(), constructor, nullable, newProjections, newScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package kt939
|
||||||
|
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
//KT-939 CommonSupertypes erases scopes associated to types
|
||||||
|
|
||||||
|
fun compare(o1 : String?, o2 : String?) : Int {
|
||||||
|
val l1 = o1?.length ?: 0
|
||||||
|
val l2 = o2?.length ?: 0
|
||||||
|
return l1 - l2 // '-' is unresolved, because the type of l1 is Int with an empty member scope
|
||||||
|
}
|
||||||
|
|
||||||
|
//KT-1117 Unresolved reference to multiply sign
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
(System.getProperty("path.separator")?.length ?: 4) * 55 + 5
|
||||||
|
|
||||||
|
val x = System.getProperty("path.separator")?.length ?: 4
|
||||||
|
x * 55 + 5
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user