Skip to content

A + sign usually means Positive #1536

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -4031,7 +4031,7 @@ signed_constant:
| PLUS FLOAT { let (f, m) = $2 in
Constant.value (Pconst_float(f, m)) }
| PLUS HASH_INT { unboxed_int $sloc $loc($2) Positive $2 }
| PLUS HASH_FLOAT { unboxed_float $sloc Negative $2 }
| PLUS HASH_FLOAT { unboxed_float $sloc Positive $2 }
;

/* Identifiers and long identifiers */
Expand Down
16 changes: 16 additions & 0 deletions ocaml/testsuite/tests/typing-layouts/unboxed_floats.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ Line 4, characters 6-9:
^^^
Error: Unbound value add
|}];;

let x = #3.0
let x = +#3.0
let x = -#3.0

let x = #3L
let x = +#3L
let x = -#3L

[%%expect{|
Line 1, characters 8-12:
1 | let x = #3.0
^^^^
Error: Unboxed float literals aren't supported yet.
|}]