-
Notifications
You must be signed in to change notification settings - Fork 453
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
Use RescriptError for exceptions #6979
base: master
Are you sure you want to change the base?
Changes from all commits
3978f09
e1d0587
13f9227
bc0aba9
98cba2e
cc31e08
1b392d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3674,7 +3674,7 @@ let rec subtype_rec env trace t1 t2 cstrs = | |
true (* handled in the fields checks *) | ||
| Record_unboxed b1, Record_unboxed b2 -> b1 = b2 | ||
| Record_inlined _, Record_inlined _ -> repr1 = repr2 | ||
| Record_extension, Record_extension -> true | ||
| Record_extension b1, Record_extension b2 -> b1.is_exception = b2.is_exception | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this casting any exception to any other exception? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't know what the code is about, I just made it compile in the most safe way :) |
||
| _ -> false in | ||
if same_repr then | ||
let violation, tl1, tl2 = Record_coercion.check_record_fields ~repr1 ~repr2 fields1 fields2 in | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1602,7 +1602,7 @@ let make_record_matching loc all_labels def = function | |
| Record_inlined _ -> | ||
Lprim (Pfield (lbl.lbl_pos, Lambda.fld_record_inline lbl), [arg], loc) | ||
| Record_unboxed _ -> arg | ||
| Record_extension -> Lprim (Pfield (lbl.lbl_pos + 1, Lambda.fld_record_extension lbl), [arg], loc) | ||
| Record_extension _ -> Lprim (Pfield (lbl.lbl_pos + 1, Lambda.fld_record_extension lbl), [arg], loc) | ||
in | ||
let str = | ||
match lbl.lbl_mut with | ||
|
@@ -2279,7 +2279,7 @@ let get_extension_cases tag_lambda_list = | |
| (cstr, act) :: rem -> | ||
let nonconsts = split_rec rem in | ||
match cstr with | ||
| Cstr_extension(path) -> ((path, act) :: nonconsts) | ||
| Cstr_extension(path, _) -> ((path, act) :: nonconsts) | ||
| _ -> assert false in | ||
split_rec tag_lambda_list | ||
|
||
|
@@ -2918,7 +2918,9 @@ let partial_function loc () = | |
let fname = | ||
Filename.basename fname | ||
in | ||
Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension), | ||
Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension { | ||
is_exception = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you know that there's no other place in the compiler where one could have forgotten to do this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you talking about adding the correct |
||
}), | ||
[transl_normal_path Predef.path_match_failure; | ||
Lconst(Const_block(Blk_tuple, | ||
[Const_base(Const_string (fname, None)); | ||
|
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 change should make extension fields have the same logic as variants. Currently if an extension has a payload, it starts with
_1
while normal variants start with_0
. I think it makes sense to have it unified. Should I include the change in a separate PR?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.
Unified sounds good to me. If this causes a lot of output changes, then yes, maybe better in a separate PR.