Never import object descriptors, for they may overwrite corresponding vals
This commit is contained in:
+5
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -215,6 +216,10 @@ public abstract class WritableScopeWithImports extends JetScopeAdapter implement
|
||||
public void importClassifierAlias(@NotNull Name importedClassifierName, @NotNull ClassifierDescriptor classifierDescriptor) {
|
||||
checkMayWrite();
|
||||
|
||||
if (DescriptorUtils.isObject(classifierDescriptor)) {
|
||||
throw new IllegalStateException("must not be object: " + classifierDescriptor);
|
||||
}
|
||||
|
||||
getCurrentIndividualImportScope().addClassifierAlias(importedClassifierName, classifierDescriptor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user