-
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
Members on Atom and Type include inherited methods from Any #12099
base: develop
Are you sure you want to change the base?
Conversation
vector_methods = Hashset.from_vector <| Meta.meta Vector . methods | ||
array_methods = Hashset.from_vector <| Meta.meta Array . methods | ||
diff = array_methods.difference vector_methods | ||
Test.with_clue "The difference should be empty, but was: "+diff.to_text <| |
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.
Would a simple .should_equal
work here?
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.
No, because Vector
's methods are a superset of Array
's methods, which is expected. For example, there is Vector.from_array
and Vector.from_polyglot_array
which is not on Array
, and that is fine.
# Conflicts: # engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/GetTypeMethodsNode.java
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 am surprised the code in Type
isn't using allTypes(...)
, but hardcodes anyMethods
. I'd expect more generic code.
...ntime-integration-tests/src/test/java/org/enso/interpreter/test/interop/AtomInteropTest.java
Outdated
Show resolved
Hide resolved
@@ -2428,7 +2428,7 @@ class RuntimeErrorsTest | |||
contextId, | |||
mainResId, | |||
Api.ExpressionUpdate.Payload.Panic( | |||
"Compile_Error", | |||
"Compile_Error.Error", |
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.
Why has this changed?
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 was about to ask @4e6 to give me a clue why this change is needed. I have no idea which part is responsible for providing this panic payload.
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java
Outdated
Show resolved
Hide resolved
…reter/test/interop/AtomInteropTest.java Co-authored-by: Jaroslav Tulach <[email protected]>
var allMethods = new HashMap<String, Function>(); | ||
for (var type : allTypes(ctx)) { | ||
var methodsOnThisType = type.methodsOnThisType(includeStaticMethods); | ||
allMethods.putAll(methodsOnThisType); |
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 if there are overrides? This code will likely put the Any.to_text
into the map and not My_Type.to_text
... it may not matter as type.getMethods(true).keySet()
- e.g. only keys are used, but then this method should be changed to Set<String>
and not provide incorrect .values()
.
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.
Fixed in 80e80e4 - methods with same name from subtypes are kept in the map and not replaced by the methods from supertypes. In other words, overridden methods are preferred.
Added test for consistency between method invocation on types in pure Enso, and method invocation on types via interop protocol in b95e3ea. I believe that at this moment, this test sufficiently covers the functionality of method dispatch in |
remove_us = locale_meta.methods + ["Value", "new", "default", "from_language_tag", "from_java", "predefined_locale_fields", "default_widget", "widget_options"] | ||
Meta.Type.Value (Meta.type_of locale_meta.value) . methods . filter (Filter_Condition.Is_In remove_us ..Remove) . sort | ||
methods_to_remove = Vector.build bldr-> | ||
bldr.append "Value" |
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.
This one should be private
unless something horribly breaks.
Fixes #12045 and #6303
Pull Request Description
getMembers
interop message on Atom and on Type now include inherited methods from super types.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.