Return Correct Name for the Module in AtomConstructor (#1375)

return the module name if it's the atom constructor of the module.
This commit is contained in:
Dmitry Bushev 2021-01-11 14:29:50 +03:00 committed by GitHub
parent 03f3c2b661
commit e2b583c64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -1,16 +1,12 @@
package org.enso.interpreter.node;
import com.oracle.truffle.api.dsl.ReportPolymorphism;
import com.oracle.truffle.api.frame.FrameUtil;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.enso.interpreter.Language;
import org.enso.interpreter.runtime.callable.atom.AtomConstructor;
import org.enso.interpreter.runtime.callable.function.Function;
import org.enso.interpreter.runtime.scope.LocalScope;
import org.enso.interpreter.runtime.scope.ModuleScope;
import org.enso.interpreter.runtime.state.Stateful;
@ReportPolymorphism
@NodeInfo(shortName = "Method", description = "A root node for Enso methods.")

View File

@ -23,7 +23,7 @@ import org.enso.pkg.QualifiedName;
/** A representation of an Atom constructor. */
@ExportLibrary(InteropLibrary.class)
public class AtomConstructor implements TruffleObject {
public final class AtomConstructor implements TruffleObject {
private final String name;
private final ModuleScope definitionScope;
@ -200,7 +200,11 @@ public class AtomConstructor implements TruffleObject {
/** @return the fully qualified name of this constructor. */
public QualifiedName getQualifiedName() {
return definitionScope.getModule().getName().createChild(getName());
if (this == this.getDefinitionScope().getAssociatedType()) {
return definitionScope.getModule().getName();
} else {
return definitionScope.getModule().getName().createChild(getName());
}
}
/** @return the fields defined by this constructor. */

View File

@ -17,6 +17,9 @@ enso-logger = { version = "0.1.3" }
enso-prelude = { version = "0.1.8" }
lexer = { version = "0.1.0", path = "../lexer/generation" }
itertools = { version = "0.9.0" }
# Pinned packages
# TODO: [DB] Remove after switching to new Rust toolchain version.
anyhow = { version = "<=1.0.37" }
[build-dependencies]