-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
[typer] fix forwarded static extension priority #9682
[typer] fix forwarded static extension priority #9682
Conversation
I agree with fixing this, but the fix looks a bit awkward like that. I'll have to check if an approach like this is really necessary. |
No prob. If |
e643d9c
to
761e400
Compare
Updated PR to apply the same logic to Also removed commented out "this" thing. It was added in 17ee33c. I guess at the time |
e1be888
to
cca7cae
Compare
This comment has been minimized.
This comment has been minimized.
cca7cae
to
262aab0
Compare
Rewrote by hand and now it is green... |
5b3a87d
to
31debbe
Compare
74a9298
to
2f437c2
Compare
Rebased. Any comments on new implementation? |
59f167c
to
75ee456
Compare
75ee456
to
8d4dbc1
Compare
This whole Maybe we should approach this from the other direction and write down what we actually want. I think we need to invert some control here by having functions such as these:
If these are atomic, we can then compose | TAbstract (a,pl) as t ->
let rec walk_abstract t f =
try
f t
with Not_found -> match t with
| TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) ->
walk_abstract (Abstract.get_underlying_type ~return_first:true a tl) f
| _ ->
raise Not_found
in
begin try
walk_abstract t find_field_on_type with Not_found -> try
walk_abstract t find_type_static_extension_for with Not_found -> try
walk_abstract t find_module_static_extension_for with Not_found -> try
walk_abstract t find_resolve_on with Not_found ->
no_field()
end This checks all "stages" of an abstract for each kind of lookup, and then tries the next kind. What do you think? |
Of course the recursion in |
I like it. Went for current design because wanted to keep source code for other parts of So do you plan to do the split by yourself in rework branch (so this PR will be closed) or should i do it here? |
I'll be working on unary operators on the next rework branch, so you can have this one! |
8d4dbc1
to
8cb31d1
Compare
Here is rewrite. |
At a first glance it looks good! I'll review it in detail tomorrow. These However, it might be a good idea to just aim for parity with this PR, and then address questions like that as a follow-up. |
I encountered those things myself while initially implementing "support @:using on typedefs" (which is, by the way, already rebased on this one). That's why there is About linked issues and this PR: |
8cb31d1
to
bc21bdf
Compare
ImportHandling.mark_import_position ctx pc; | ||
AKUsingField (make_static_extension_access c cf e false p) | ||
| _ -> raise Not_found | ||
with Unify_error el | Error (Unify el,_) -> |
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.
Note for the future: Check why we're catching both of these. That seems weird.
Ok I've checked it. I don't like this I'd like @RealyUniqueName to take a look at this too. |
Any specific reason? How otherwise would you achieve what you mentioned before "type expression, but (optionally) with different type than it is"? Regarding |
What I mean is that we can just work with the |
Another issue related to losing abstract type info upon forwarding: #6639 |
I agree with @Simn regarding |
| TAnon a -> | ||
(try | ||
let f = PMap.find i a.a_fields in | ||
if has_class_field_flag f CfImpl && not (has_class_field_flag f CfEnum) then display_error ctx "Cannot access non-static abstract field statically" pfield; |
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.
It's a TAnon
case. I guess this check is out of place.
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.
TAnon
can have AbstractStatics
status, this is for this case.
Here is a test that checks that this is in place.
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.
Then it probably should be moved to match !(a.a_status)
below.
This one is the first mentioned issue (don't counting one in PR description).
As i understand his remarks were about replacing, in the future, passing down |
In the code you either type_field_by_type t e
(* instead of *)
type_field_by_type ~t e or type_field_by_type (follow e.etype) e
(* instead of *)
type_field_by_type e That would allow to drop |
bc21bdf
to
2904e5d
Compare
Already pushed removal of optionality from t. |
Closes #9680 if it is agreed upon.
In the test couldn't mark extension classes as private, gave them mangled names instead.