-
Notifications
You must be signed in to change notification settings - Fork 32
Improve module method checks #283
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
Improve module method checks #283
Conversation
bb1da72
to
ce9abc4
Compare
class Foo(val z) with
blah should now be elaborated into class Foo(z‹123›) with
val member:z‹124› = z‹123›
blah I didn't differentiate |
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
I changed a lot of tests to replace all I also checked them so to not add |
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.
Nice change, thanks!
Maybe @CAG2Mark you could take a quick look at the lifter changes?
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.
LGTM with regards to the lifter. I've left one minor comment and a reply to another comment.
(p.s. the lifter logic is quite complicated, so good job on figuring it out :P)
BTW @LPTK it seems that VarSymbol
s are often created inside later IR passes because it's unavoidable, but you mentioned a while ago that VarSymbol
s all come from user defined variables. I think that in the future, it would be good to add a field to VarSymbol
such as isUserDefined
to make this distinction more explicit.
@AnsonYeung This PR may be of interest to you since it might change the way you need to call |
so preCtor is also for generating the field assignment, is there any reason for handling aux param differently? I don’t think it causes issue with handler lowering. In fact I think if preCtor and ctor is combined into a single block then it would be trivial to fix one of the current broken case with super call being effectful. |
Probably because it's currently assumed to be handled by the front-end (but we don't have aux params in the front-end yet) but you're right. Though doing this will require even more changes in the lifter. |
They should definitely be handled the same. The only difference is that thesae params won't get
Weren't you the one who introduced the In e37d8f8#diff-72bbb753659dd44a5e47f3cd0b3954e4ee95fda127ca491a2c267461779c60fbR126 What was the purpose of using a separate block, and does that still make sense now? |
I'm not sure about it now. Does lifter need it now (as I think it may need to insert some extra fields)? The original intent was just a hack to insert super calls before JSBuilder emits the field initializations. In any case, I am completely fine with it being removed now. |
@AnsonYeung Ok, we'll probably want to remove it in a later PR. |
On another note (sorry for putting so many extra comments in this PR), I think the |
@CAG2Mark Thanks for the suggestion. I intend for mlscript/hkmc2/shared/src/test/mlscript/basics/CyclicValues.mls Lines 6 to 13 in 4e1d3cf
|
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.
LGTM
This PR improves the module method checks introduced in #233, and makes preparation in order to move all the checks to the resolution stage. It also fixes:
the problem that "module" parameters were not treated as modules
the problem that self referencing modules were not treated as modules
the problem that term definitions returning a module were not treated as modules