Temporary fix for duplicate key in constructor resolution
This commit is contained in:
@@ -1,6 +1,15 @@
|
|||||||
namespace jet.lang
|
namespace jet.lang
|
||||||
|
|
||||||
class Array<T> {
|
class Iterator<out T> {
|
||||||
|
fun next() : T
|
||||||
|
val hasNext : Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
class Iterable<out T> {
|
||||||
|
fun iterator() : Iterator<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
class Array<T> : Iterable<T> {
|
||||||
fun get(index : Int) : T
|
fun get(index : Int) : T
|
||||||
fun set(index : Int, value : T) : Unit
|
fun set(index : Int, value : T) : Unit
|
||||||
}
|
}
|
||||||
@@ -34,15 +43,6 @@ class Range<in T : Comparable<T>> {
|
|||||||
fun contains(item : T) : Boolean
|
fun contains(item : T) : Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class Iterator<out T> {
|
|
||||||
fun next() : T
|
|
||||||
val hasNext : Boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
class Iterable<out T> {
|
|
||||||
fun iterator() : Iterator<T>
|
|
||||||
}
|
|
||||||
|
|
||||||
class IntRange<T> : Range<T>, Iterable<T> {
|
class IntRange<T> : Range<T>, Iterable<T> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ public interface BindingContext {
|
|||||||
FunctionDescriptor getFunctionDescriptor(JetFunction declaration);
|
FunctionDescriptor getFunctionDescriptor(JetFunction declaration);
|
||||||
PropertyDescriptor getPropertyDescriptor(JetProperty declaration);
|
PropertyDescriptor getPropertyDescriptor(JetProperty declaration);
|
||||||
|
|
||||||
DeclarationDescriptor getDeclarationDescriptor(JetDeclaration declaration);
|
|
||||||
|
|
||||||
JetType getExpressionType(JetExpression expression);
|
JetType getExpressionType(JetExpression expression);
|
||||||
|
|
||||||
JetScope getTopLevelScope();
|
JetScope getTopLevelScope();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class BindingTraceContext extends BindingTrace implements BindingContext
|
|||||||
private final Map<JetTypeReference, JetType> types = new HashMap<JetTypeReference, JetType>();
|
private final Map<JetTypeReference, JetType> types = new HashMap<JetTypeReference, JetType>();
|
||||||
private final Map<DeclarationDescriptor, PsiElement> descriptorToDeclarations = new HashMap<DeclarationDescriptor, PsiElement>();
|
private final Map<DeclarationDescriptor, PsiElement> descriptorToDeclarations = new HashMap<DeclarationDescriptor, PsiElement>();
|
||||||
private final Map<PsiElement, DeclarationDescriptor> declarationsToDescriptors = new HashMap<PsiElement, DeclarationDescriptor>();
|
private final Map<PsiElement, DeclarationDescriptor> declarationsToDescriptors = new HashMap<PsiElement, DeclarationDescriptor>();
|
||||||
|
private final Map<PsiElement, ConstructorDescriptor> constructorDeclarationsToDescriptors = new HashMap<PsiElement, ConstructorDescriptor>();
|
||||||
private final Set<JetFunctionLiteralExpression> blocks = new HashSet<JetFunctionLiteralExpression>();
|
private final Set<JetFunctionLiteralExpression> blocks = new HashSet<JetFunctionLiteralExpression>();
|
||||||
private final Set<JetElement> statements = new HashSet<JetElement>();
|
private final Set<JetElement> statements = new HashSet<JetElement>();
|
||||||
|
|
||||||
@@ -54,8 +55,18 @@ public class BindingTraceContext extends BindingTrace implements BindingContext
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) {
|
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) {
|
||||||
descriptorToDeclarations.put(descriptor.getOriginal(), declaration);
|
safePut(descriptorToDeclarations, descriptor.getOriginal(), declaration);
|
||||||
declarationsToDescriptors.put(declaration, descriptor.getOriginal());
|
if (descriptor instanceof ConstructorDescriptor) {
|
||||||
|
safePut(constructorDeclarationsToDescriptors, declaration, (ConstructorDescriptor) descriptor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
safePut(declarationsToDescriptors, declaration, descriptor.getOriginal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private <K, V> void safePut(Map<K, V> map, K key, V value) {
|
||||||
|
V oldValue = map.put(key, value);
|
||||||
|
// assert oldValue == null || oldValue == value : key + ": " + oldValue + " and " + value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,11 +86,6 @@ public class BindingTraceContext extends BindingTrace implements BindingContext
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeclarationDescriptor getDeclarationDescriptor(JetDeclaration declaration) {
|
|
||||||
return declarationsToDescriptors.get(declaration);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration) {
|
public NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration) {
|
||||||
return (NamespaceDescriptor) declarationsToDescriptors.get(declaration);
|
return (NamespaceDescriptor) declarationsToDescriptors.get(declaration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,6 @@ public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return DescriptorUtil.renderPresentableText(this) + "[" + getClass().getCanonicalName()+ "]";
|
return DescriptorUtil.renderPresentableText(this) + "[" + getClass().getCanonicalName() + "@" + System.identityHashCode(this) + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
fun concat(l: Array<String>): String {
|
fun concat(l: Array<String>): String? {
|
||||||
val sb = new StringBuilder()
|
val sb = new StringBuilder()
|
||||||
for(s in l) {
|
for(s in l) {
|
||||||
sb.append(s)
|
sb.append(s)
|
||||||
}
|
}
|
||||||
s.toString()
|
sb.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user