-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoscoping should not escape True and False #9797
Autoscoping should not escape True and False #9797
Conversation
@@ -1,3 +1,5 @@ | |||
package org.enso.compiler.test.context | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed probably by mistake 931baa4#diff-351fde5aa2d3fd1c17f0af68d70d9c7ab9f959effec19078b1949d86da36502d
case Identifier.Qualified(name) => name.toString | ||
case Identifier.Unqualified(name) => s"..$name" | ||
case Identifier.Qualified(name) => name.toString | ||
case Identifier.Unqualified("True") => "True" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid hardcoding True
and False
? Cannot the builder detect that the name
is actually re-exported from the library under the same name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this smells fishy. Hardcoded values in otherwise constant-free logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was about the True and False constructors.
Cannot the builder detect that the name is actually re-exported from the library under the same name?
I'll try and see if there is enough info to implement this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot the builder detect that the name is actually re-exported from the library under the same name?
@JaroslavTulach re-exports are computed after the suggestions are built
enso/engine/runtime/src/main/java/org/enso/interpreter/runtime/TruffleCompilerContext.java
Lines 558 to 578 in 32c3f5f
libraryModules | |
.flatMap( | |
module -> { | |
var sug = | |
SuggestionBuilder.apply(module, getTypeHierarchy(), compiler) | |
.build(module.getName(), module.getIr()) | |
.toVector() | |
.filter(Suggestion::isGlobal); | |
var exports = exportsBuilder.build(module.getName(), module.getIr()); | |
exportsMap.addAll(module.getName(), exports); | |
return sug; | |
}) | |
.map( | |
suggestion -> { | |
scala.collection.immutable.Set<String> identity = new ListSet<>(); | |
var reexports = | |
exportsMap.get(suggestion).stream() | |
.map(QualifiedName::toString) | |
.reduce(identity, SetOps::incl, SetOps::union); | |
return suggestion.withReexports(reexports); | |
}) |
To make this logic work, I need to make the tag values calculation as a third step:
- build suggestions
- compute re-exports
- compute tag values
I can return to this issue after the ydoc is finished
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, feel free to integrate the "quick fix".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the fact that True
and False
are hardcoded... but feel free to integrate the fix.
Pull Request Description
close #9765
Changelog:
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.