-
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
Use BuiltinRootNode.ArgNode
to extract argument for a builtin method
#12201
base: develop
Are you sure you want to change the base?
Conversation
public class Boolean extends Builtin { | ||
public final class Boolean extends Builtin { | ||
public Boolean() { | ||
super(java.lang.Boolean.class); |
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.
Now we attempt to provide a representationType
to each Builtin
. That way we can deduce from signature methods having argument like boolean
that the desired builtin is Boolean
and the Enso type should be Standard.Base.Data.Boolean.Boolean
. With that information we can extract (via CastToNode
) such a type from EnsoMultiValue
....
Right now there are two dataflow errors:
I was debugging thru it, but I don't think I get any idea what can be the problem? Maybe something with wrapping errors? But why? |
Currently there are two failures: Again, I am not really sure why at present. |
@@ -3,4 +3,8 @@ | |||
import org.enso.interpreter.dsl.BuiltinType; | |||
|
|||
@BuiltinType | |||
public class Polyglot extends Builtin {} | |||
public final class Polyglot extends Builtin { | |||
public Polyglot() { |
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'd say we have way too many Builtin
s. Not sure why Polyglot
or Debug
should be builtin types at all!?
} | ||
if (is(REQUIRES_CAST)) { | ||
var ctx = EnsoContext.get(this); | ||
if (this.ensoType == null) { |
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 first time ArgNode
is requested to "cast", it searches for the ensoType
representing the value of the argument. It would be better to do this when the ArgNode
is being created, but it may be too early (before Standard.Base
types are loaded in), so I haven't even tried.
Opinions?
I believe the code is in shape to receive some inception review. |
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.
Generally looks like a good idea. Before merging, please don't forget to benchmark it. I am interested what will be the impact on performance.
lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/BuiltinsProcessor.java
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/BuiltinRootNode.java
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/BuiltinRootNode.java
Show resolved
Hide resolved
flags |= IS_SELF; | ||
} | ||
if (isArray) { | ||
flags |= IS_ARRAY; |
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.
What is the purpose of IS_ARRAY? It seems that it is not used anywhere
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 have no idea! All I know: it was there. CCing @hubertp.
Maybe it is unused since I removed StandardOption array support.
…into wip/jtulach/BuiltinArgNode11827
|
||
slice = res.slice 1 4 | ||
Warning.get_all slice wrap_errors=True . map .value . should_equal [(Map_Error.Error 3 'warn4'), (Map_Error.Error 2 'warn3'), (Map_Error.Error 1 'warn2'), (Map_Error.Error 0 'warn1')] | ||
slice_warn = Warning.get_all slice wrap_errors=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.
We need 91d3584 for this slice
checks to pass:
slice
itselfhasWarnings
, but only internallyslice
isn't wrapped withWithWarnings
- the checks here rely on
slice
having the warnings only internally
I am not sure whether checking only for WithWarnings
is desirable behavior or just an oversight caused by the generator code being written sooner than WarningsLibrary
introduced. Options, @hubertp?
Pull Request Description
to_text
on intersection types #12192 (comment) states:EnsoMultiValue
in the "builtin method prelude code"Node
ArgNode
& co.@Specialization
s done inside ofArgNode
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,