-
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
Polish to_text
on intersection types
#12192
base: develop
Are you sure you want to change the base?
Conversation
to_text
on _intersection types_to_text
on intersection types
…s via StructsLibrary
91597b5
to
3196767
Compare
@@ -302,7 +302,7 @@ Object doMultiValue( | |||
if (fnAndType != null) { | |||
var ctx = EnsoContext.get(this); | |||
if (ctx.getBuiltins().any() != fnAndType.getRight()) { | |||
var unwrapSelf = castTo.findTypeOrNull(fnAndType.getRight(), self, false, false); | |||
var unwrapSelf = castTo.findTypeOrNull(fnAndType.getRight(), self, true, false); |
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.
Reorders the intersection types to make sure the value of the type we dispatch the method to is at EnsoMultiValue.firstDispatch
.
ab.a_id_unchecked . is_a A . should_be_true | ||
ab.a_id_unchecked . is_a B . should_be_true | ||
ab.a_id_unchecked.a_method . should_equal "A method" | ||
ab.a_id_unchecked.b_method . should_equal "B method" | ||
Test.expect_panic No_Such_Method (ab.a_id_unchecked.b_method) |
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.
As a result of 3196767 we have to make sure that dispatching a method on self
moves the type of the method to the firstDispatch
. This is done by https://github.com/enso-org/enso/pull/12192/files#r1935731256, but:
- right now the reordering hides all the other types
- semantically it is not necessary to hide the other types
- we could keep them visible
It is just simpler to hide the other types as there is an implementation doing that available right now. Opinions? Wanna better behavior at no slowdown? CCing @radeusgd.
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'm not 100% sure yet as all of this has many implications that only come out in practice.
But at first, I think that hiding actually seems consistent with type checking requirements - inside of method A.foo self
I actually do want to assume that self:A
- so it makes sense for other 'parts' to be hidden.
Now, when dispatch of an instance method allows To do so we have to change the "builtin prelude code" - e.g. the way we prepare the values before invoking the |
Jaroslav Tulach reports a new STANDUP for yesterday (2025-02-04): Progress: .
|
Jaroslav Tulach reports a new STANDUP for yesterday (2025-02-05): Progress: .
|
Jaroslav Tulach reports a new STANDUP for yesterday (2025-02-06): Progress: .
|
Jaroslav Tulach reports a new STANDUP for today (2025-02-07): Progress: .
|
#12201) - as #12192 (comment) states: - there is a need to extract values from `EnsoMultiValue` in the _"builtin method prelude code"_ - to enable _specializations based on type of arguments_, we need to wrap such _prelude_ by a `Node` - hence introducing `ArgNode` & co. - it kinda replaces the _"static code emitted"_ by annotation processor - with Truffle `@Specialization`s done inside of `ArgNode` - making this all more Truffle-like
Pull Request Description
Fixes #11827 by better coordination of dispatch to
EnsoMultiValue
.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,