-
Notifications
You must be signed in to change notification settings - Fork 326
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
Fix displaying of host values in chrome devtools #11468
Conversation
engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
Show resolved
Hide resolved
HostMethodCallNode.getPolyglotCallType(value, symbol, interopUncached); | ||
try { | ||
switch (polyglotCallType) { | ||
case CONVERT_TO_DATE -> { |
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.
Here is the main idea. Chrome inspector instrument builds DebugLocalScope
which holds a materialized frame with all the bindings. If a binding is a host object that can/should be converted to an appropriate Enso builtin type before sending back to the inspector, it is converted here. This is pretty much the same kind of conversion that is done inside InvokeMethodNode on the self
argument before any kind of method dispatch is done.
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 expand this to other languages than Java - e.g. Python & co.
- I don't understand the different between
PolyglotCall
& the otherenum
- I still believe the code should be in
EnsoLanguage.getLanguageView
engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
Show resolved
Hide resolved
...ne/runtime/src/main/java/org/enso/interpreter/node/callable/resolver/HostMethodCallNode.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
Outdated
Show resolved
Hide resolved
engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
Show resolved
Hide resolved
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.
Having all of this in getLanguageView
should show beneficial in the future. Hopefully.
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/vector/ArrayBuilder.java
Outdated
Show resolved
Hide resolved
Blocked by #11538 |
How exactly this is blocked by ? |
The test in enso/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/WarningsTest.java Line 148 in 339c275
v.getMetaObject() on that value returns non-null, but on develop it returns null. And for some reason, warning2.getMetaObject() returns null, thus the test fails. I figured out it would be just easier to first ensure that we stick to correct Truffle contracts and do that in a separate PR.
|
# Conflicts: # engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/WarningsTest.java
…age. This is a fix after merge of develop.
Primitive values is expected not to have meta object.
engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BigNumberTest.java
Outdated
Show resolved
Hide resolved
Right now I see following four failures:
This is a fix that helps at least with the diff --git engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/ValuesGenerator.java engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/ValuesGenerator.java
index 4b23c33002..5b2288e9c2 100644
--- engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/ValuesGenerator.java
+++ engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/ValuesGenerator.java
@@ -445,7 +445,9 @@ public final class ValuesGenerator {
}
for (var v : collect) {
assertTrue("It's a number" + v, v.isNumber());
+ if (!v.isNumber()) {
+ assertTrue("It's a number" + v, v.isNumber());
+ }
}
return collect;
}
@@ -504,7 +506,9 @@ public final class ValuesGenerator {
}
for (var v : collect) {
assertTrue("It is an boolean" + v, v.isBoolean());
+ if (!v.isBoolean()) {
+ assertTrue("It is an boolean" + v, v.isBoolean());
+ }
}
return collect;
}
diff --git engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java
index 3167895cb7..9ec91872a3 100644
--- engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java
+++ engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java
@@ -397,6 +397,9 @@ public final class EnsoLanguage extends TruffleLanguage<EnsoContext> {
var cons = b ? bool.getTrue() : bool.getFalse();
return AtomNewInstanceNode.getUncached().newInstance(cons);
}
+ if (value instanceof Double d) {
+ return new LanguageViewWrapper(d);
+ }
var interop = InteropLibrary.getUncached();
// We want to know if the value can be converted to some Enso builtin type.
// In order to do that, we are trying to infer PolyglotCallType of value.to method. |
Fixes #7890
Pull Request Description
Chrome inspector now displays polyglot objects that have a corresponding Enso builtin type as enso objects:
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.