-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
type return/break/continue expressions with monomorphs instead of Dynamic (see #10744) #10745
Conversation
…amic (see HaxeFoundation#10744) this is what we already do for `throw` since 2008 (HaxeFoundation@9cee2fc)
I'm wondering if we should be a bit more clever and type all terminators as (ideally we of course want a bottom type but that's a different topic) |
Tried that quickly and ran into problems with inlined returns, so it needs more investigation. |
@ncannasse You wouldn't happen to remember why this was typed as |
Looking at this again, I wonder if we should only create monomorphs for this when we're typing a value. I don't see what we gain by creating monos for any block-level What do you think? |
Makes sense. I think I've tried that but had some issue with inlining and didn't have time to figure it out since then... |
# Conflicts: # src/typing/typer.ml
@@ -36,6 +36,12 @@ open Operators | |||
(* ---------------------------------------------------------------------- *) | |||
(* TOOLS *) | |||
|
|||
let mono_or_dynamic ctx with_type p = match with_type with | |||
| WithType.NoValue -> | |||
t_dynamic |
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.
should it be Void maybe?
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 a bit worried about some crazy inline situation where we end up with Void in a value-place... With Dynamic we at least have the same behavior as before.
this is what we already do for
throw
since 2008 (9cee2fc)