-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support Record Expression #74
Conversation
lib/abstract_format.ml
Outdated
begin match record_field_of_sf sf with | ||
| Ok (RecordField {line; field_name; ty=None; default_expr=Some e}) -> | ||
(line, field_name, e) |> return | ||
| Ok _ -> failwith "cannot reach here" |
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.
Could you use Err.Invalid_input
?
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.
fixed.
lib/abstract_format.ml
Outdated
begin match record_field_of_sf sf with | ||
| Ok (RecordField {line; field_name; ty=None; default_expr=Some e}) -> | ||
(line, field_name, e) |> return | ||
| Ok _ -> failwith "cannot reach here" |
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.
ditto
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.
fixed.
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.
Sorry, one more.
lib/abstract_format.ml
Outdated
| Error e -> Error e | ||
end | ||
in | ||
let%bind expr = sf_expr |> expr_of_sf in |
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.
Could you add |> track ~loc:[%here]
?
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.
thanks
lib/abstract_format.ml
Outdated
| Ok (RecordField {line; field_name; ty=None; default_expr=Some e}) -> | ||
(line, field_name, e) |> return | ||
| Ok _ -> | ||
Err.create ~loc:[%here] (Err.Invalid_input ("cannot reach here", sf)) |> Result.fail |
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.
Could you make error message more detailed? e.g., "record field must have field name and expression" 🙏
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 see 🙏
lib/abstract_format.ml
Outdated
| Ok (RecordField {line; field_name; ty=None; default_expr=Some e}) -> | ||
(line, field_name, e) |> return | ||
| Ok _ -> | ||
Err.create ~loc:[%here] (Err.Invalid_input ("cannot reach here", sf)) |> Result.fail |
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.
ditto 🙏
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 see 🙏
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
for #54
Support following expressions.
#user{name = "Taro", admin = true}
U#user.name
#user.name
U#user{admin = true}