Skip to content
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

float32 otherlib #2492

Merged
merged 180 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
430b6b7
float32 in flambda2
TheNumbat Mar 14, 2024
627203b
fixes
TheNumbat Mar 14, 2024
296e7b8
arm
TheNumbat Mar 14, 2024
a0a2282
more crs
TheNumbat Mar 14, 2024
7458491
primitives
TheNumbat Mar 14, 2024
8644e75
format
TheNumbat Mar 14, 2024
d0342f1
upstream build
TheNumbat Mar 14, 2024
797a7a6
delete array case
TheNumbat Mar 19, 2024
fad1816
casts
TheNumbat Mar 19, 2024
0bd3e82
format
TheNumbat Mar 19, 2024
f195d02
Merge branch 'f32-fl2' into f32-backend
TheNumbat Mar 19, 2024
9c8d442
testsuite cmm parser
TheNumbat Mar 19, 2024
a2af96d
format
TheNumbat Mar 19, 2024
9451a8f
cast fl2
TheNumbat Mar 19, 2024
84e23ff
num conv
TheNumbat Mar 19, 2024
39b36ca
merge
TheNumbat Mar 19, 2024
e42799a
fix name in cfg
TheNumbat Mar 19, 2024
0b86abd
float32 static consts
TheNumbat Mar 19, 2024
2fe6ea4
add test
TheNumbat Mar 19, 2024
7e93f52
fixes
TheNumbat Mar 19, 2024
8d56965
Merge branch 'f32-fl2' into f32-backend
TheNumbat Mar 19, 2024
8ade880
another fix
TheNumbat Mar 19, 2024
7f64da8
Merge branch 'f32-fl2' into f32-backend
TheNumbat Mar 19, 2024
0d24bdd
fix nan test
TheNumbat Mar 19, 2024
0937fc4
actually use cconst_float32
TheNumbat Mar 20, 2024
e7f7b9e
float32 operations
TheNumbat Mar 21, 2024
28c4360
cmm stubs
TheNumbat Mar 21, 2024
ed13892
fix asserts
TheNumbat Mar 21, 2024
2ea3d51
separate storage single and actual float32
TheNumbat Mar 22, 2024
4375a5d
merge
TheNumbat Mar 22, 2024
1da7d02
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
b6662e4
fix cmm test parser again
TheNumbat Mar 22, 2024
3e436c4
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
5b81480
fix operation unboxing
TheNumbat Mar 22, 2024
170a192
oops
TheNumbat Mar 22, 2024
d83be31
comments
TheNumbat Mar 22, 2024
ca93bd7
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
d8663f1
parsecmm again
TheNumbat Mar 22, 2024
e8e169c
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
96403b6
Merge branch 'main' into f32-fl2
TheNumbat Mar 22, 2024
4068688
merge
TheNumbat Mar 22, 2024
15944f5
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
4ff6ad9
fix
TheNumbat Mar 22, 2024
2d2498d
parsecmm again
TheNumbat Mar 22, 2024
52f66d8
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
5ea8e3e
arm
TheNumbat Mar 22, 2024
0ef407b
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Mar 22, 2024
7fbbae6
clean up commit history
TheNumbat Mar 25, 2024
6663075
normalize zero/nan in hash
TheNumbat Mar 26, 2024
3785d6a
Apply suggestions from code review
TheNumbat Mar 26, 2024
62ad563
Update backend/x86_binary_emitter.ml
TheNumbat Apr 1, 2024
3387841
address comments
TheNumbat Apr 2, 2024
134c753
restore copyright headers
TheNumbat Apr 2, 2024
9fa47cd
unify single mem chunks
TheNumbat Apr 2, 2024
d9347fe
fix size_expr f32 const
TheNumbat Apr 2, 2024
a8d5321
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
50aa877
merge
TheNumbat Apr 2, 2024
ccfbe36
merge fix from later pr
TheNumbat Apr 2, 2024
b0d5f27
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
a8f23ed
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 2, 2024
c7437ba
fix comment
TheNumbat Apr 2, 2024
ae04a8e
parsecmm...
TheNumbat Apr 2, 2024
7ea280e
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
d218a6f
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 2, 2024
01c848f
arm build
TheNumbat Apr 2, 2024
ac35a97
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
1f47ecd
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 2, 2024
b13bd15
new machtype component
TheNumbat Apr 2, 2024
300c75a
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
b6f6391
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 2, 2024
062b106
add ext arg test
TheNumbat Apr 2, 2024
1b19d02
fix ext args
TheNumbat Apr 2, 2024
f1daf13
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 2, 2024
bb186b2
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 2, 2024
7eaa6ec
Apply suggestions from code review
TheNumbat Apr 3, 2024
f5766a3
comments
TheNumbat Apr 3, 2024
a42f8f7
use 4b size in selectgen
TheNumbat Apr 3, 2024
380c715
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 3, 2024
9cb2f0f
merge
TheNumbat Apr 3, 2024
e38b256
real f32 ops in f32_by_bit_pattern
TheNumbat Apr 8, 2024
a7b32de
float32 parsing (untested)
TheNumbat Apr 8, 2024
050b46b
install stubs for testsuite
TheNumbat Apr 8, 2024
f899698
merge
TheNumbat Apr 8, 2024
d08462a
merge
TheNumbat Apr 8, 2024
b2ff074
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 8, 2024
5c150cd
merge arm changes
TheNumbat Apr 8, 2024
95bb9b6
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 8, 2024
7d45d1f
Update ocaml/middle_end/flambda/closure_conversion.ml
TheNumbat Apr 9, 2024
64b2663
address comments
TheNumbat Apr 9, 2024
d165586
Merge branch 'f32-fl2' of github.com:ocaml-flambda/flambda-backend in…
TheNumbat Apr 9, 2024
62d2c75
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 9, 2024
9eec365
comment
TheNumbat Apr 9, 2024
0f9dae1
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 9, 2024
bb618c0
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 9, 2024
66187bb
merge
TheNumbat Apr 9, 2024
cbd71a1
simplify locale defs
TheNumbat Apr 9, 2024
fa7870b
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 9, 2024
ebb0d6a
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 9, 2024
5834a7c
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 9, 2024
03ad39a
fix f32 alloc size
TheNumbat Apr 9, 2024
c219e35
fmt
TheNumbat Apr 9, 2024
8e9bdf8
move f32 lib to external
TheNumbat Apr 11, 2024
7f69249
fix build system
TheNumbat Apr 11, 2024
9ac6060
format
TheNumbat Apr 11, 2024
eacd280
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 11, 2024
3b9867a
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 11, 2024
983b270
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 11, 2024
b78a2e4
fix compare
TheNumbat Apr 16, 2024
f551594
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 16, 2024
4daf82d
fix static const
TheNumbat Apr 16, 2024
203d218
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 16, 2024
2925238
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 16, 2024
df8abe2
add neq_float32
TheNumbat Apr 16, 2024
ae3d4a5
preserve width in simplify comparison
TheNumbat Apr 16, 2024
e2bac20
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 16, 2024
04bd989
typo
TheNumbat Apr 16, 2024
77e83d9
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 16, 2024
a12ba29
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 16, 2024
ff8762c
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 16, 2024
2a3a4f2
typo
TheNumbat Apr 16, 2024
fc02a69
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 16, 2024
0cfb535
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 16, 2024
191df17
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 16, 2024
df6688e
another tagging fix
TheNumbat Apr 16, 2024
c50b64f
Merge branch 'f32-fl2' into f32-backend
TheNumbat Apr 16, 2024
555c85b
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 16, 2024
dc60a19
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 16, 2024
8528bab
squash
TheNumbat Apr 16, 2024
612beb2
remove pattern match
TheNumbat Apr 17, 2024
9146703
update test
TheNumbat Apr 17, 2024
4bdc1de
adjustment
TheNumbat Apr 17, 2024
ea62c43
adjustment
TheNumbat Apr 17, 2024
089a0ea
address comment
TheNumbat Apr 19, 2024
cbe341b
whitespace
TheNumbat Apr 19, 2024
d482728
preserve width in negation of other side
TheNumbat Apr 24, 2024
994435e
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 24, 2024
4bbcab3
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 24, 2024
b0ed404
merge
TheNumbat Apr 26, 2024
3db086b
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 26, 2024
4aaa542
merge
TheNumbat Apr 26, 2024
261bc62
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 26, 2024
ac288c1
fix arm build
TheNumbat Apr 26, 2024
1792a07
Merge branch 'f32-backend' into f32-fl2-ops
TheNumbat Apr 26, 2024
76ff55f
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 26, 2024
14d6d16
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 26, 2024
99b0fa8
Merge branch 'main' into f32-fl2-ops
TheNumbat Apr 26, 2024
d1908f5
caml_hash_exn
TheNumbat Apr 26, 2024
096c550
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 26, 2024
205d415
fix test
TheNumbat Apr 26, 2024
6015401
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 26, 2024
736b9b4
Refactor otherlibs build (#2477)
TheNumbat Apr 29, 2024
ef742ca
Merge branch 'main' into f32-fl2-ops
TheNumbat Apr 29, 2024
dc44058
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 29, 2024
81ed6dd
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 29, 2024
28c0b53
Merge branch 'main' into f32-fl2-ops
TheNumbat Apr 30, 2024
e6292a6
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat Apr 30, 2024
9c97040
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat Apr 30, 2024
d36692d
squash
TheNumbat Apr 30, 2024
437e322
add toplevel printing for float32
TheNumbat Apr 30, 2024
5f6c62c
fix deps
TheNumbat Apr 30, 2024
676fe93
delete f32 lit crs
TheNumbat Apr 30, 2024
0767acd
promote tests
TheNumbat Apr 30, 2024
bcab4d2
install floats stubs lib
TheNumbat May 1, 2024
3ce16c1
add s suffix to printer
TheNumbat May 1, 2024
97b165a
test
TheNumbat May 1, 2024
153d894
operator module
TheNumbat May 1, 2024
dff064a
test min_max
TheNumbat May 1, 2024
31be758
fix test
TheNumbat May 1, 2024
ff1dd31
fix float_arith kinds
TheNumbat May 1, 2024
f796c15
Merge branch 'f32-fl2-ops' into f32-backend-ops
TheNumbat May 1, 2024
ecf95a5
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat May 1, 2024
ad615d5
Merge branch 'f32-lit' into f32-lib2
TheNumbat May 1, 2024
3524b17
address comments
TheNumbat May 6, 2024
664faaf
add more string tests
TheNumbat May 7, 2024
58c751d
squash for review
TheNumbat May 7, 2024
0ca2a02
functorize binary_float_comp
TheNumbat May 7, 2024
a0b462d
merge
TheNumbat May 7, 2024
d5a8ce4
Merge branch 'f32-backend-ops' into f32-lit
TheNumbat May 7, 2024
219d2dc
merge
TheNumbat May 7, 2024
7df579a
merge
TheNumbat May 9, 2024
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
Prev Previous commit
Next Next commit
address comment
  • Loading branch information
TheNumbat committed Apr 19, 2024
commit 089a0ea5cc29f7c9f39b632fdf695ab103b39b2d
5 changes: 3 additions & 2 deletions ocaml/lambda/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2868,8 +2868,8 @@ let combine_constant value_kind loc arg cst partial ctx def
(Pfloatcomp (Pfloat64, CFlt)) arg
const_lambda_list
| Const_float32 _ ->
(* CR mslater: (float32) pattern matching *)
Parmatch.raise_matched_float32 ()
(* Should be caught in do_compile_matching. *)
Misc.fatal_error "Found unexpected float32 literal pattern."
| Const_unboxed_float _ ->
make_test_sequence value_kind loc fail
(Punboxed_float_comp (Pfloat64, CFneq))
Expand Down Expand Up @@ -3543,6 +3543,7 @@ and do_compile_matching ~scopes value_kind repr partial ctx pmh =
compile_no_test ~scopes value_kind
(divide_record ~scopes lbl.lbl_all ph)
Context.combine repr partial ctx pm
| Constant (Const_float32 _) -> Parmatch.raise_matched_float32 ()
| Constant cst ->
compile_test
(compile_match ~scopes value_kind repr partial)
Expand Down
38 changes: 27 additions & 11 deletions ocaml/testsuite/tests/typing-small-numbers/test_disabled.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,79 +16,79 @@ let _ = 1.0s;;
Line 1, characters 8-12:
1 | let _ = 1.0s;;
^^^^
Error: Unknown modifier 's' for literal 1.0s
Error: Found 32-bit float literal 1.0s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 1.s;;
[%%expect{|
Line 1, characters 8-11:
1 | let _ = 1.s;;
^^^
Error: Unknown modifier 's' for literal 1.s
Error: Found 32-bit float literal 1.s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 1e10s;;
[%%expect{|
Line 1, characters 8-13:
1 | let _ = 1e10s;;
^^^^^
Error: Unknown modifier 's' for literal 1e10s
Error: Found 32-bit float literal 1e10s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 1e+1s;;
[%%expect{|
Line 1, characters 8-13:
1 | let _ = 1e+1s;;
^^^^^
Error: Unknown modifier 's' for literal 1e+1s
Error: Found 32-bit float literal 1e+1s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 1e-1s;;
[%%expect{|
Line 1, characters 8-13:
1 | let _ = 1e-1s;;
^^^^^
Error: Unknown modifier 's' for literal 1e-1s
Error: Found 32-bit float literal 1e-1s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 0x111.000s;;
[%%expect{|
Line 1, characters 8-18:
1 | let _ = 0x111.000s;;
^^^^^^^^^^
Error: Unknown modifier 's' for literal 0x111.000s
Error: Found 32-bit float literal 0x111.000s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 0x1.4p+0s;;
[%%expect{|
Line 1, characters 8-17:
1 | let _ = 0x1.4p+0s;;
^^^^^^^^^
Error: Unknown modifier 's' for literal 0x1.4p+0s
Error: Found 32-bit float literal 0x1.4p+0s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 0xf.ffffffffffff8p+1020s;;
[%%expect{|
Line 1, characters 8-32:
1 | let _ = 0xf.ffffffffffff8p+1020s;;
^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unknown modifier 's' for literal 0xf.ffffffffffff8p+1020s
Error: Found 32-bit float literal 0xf.ffffffffffff8p+1020s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 0x8p-972s;;
[%%expect{|
Line 1, characters 8-17:
1 | let _ = 0x8p-972s;;
^^^^^^^^^
Error: Unknown modifier 's' for literal 0x8p-972s
Error: Found 32-bit float literal 0x8p-972s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = 0xc.d5e6fp+1_24s;;
[%%expect{|
Line 1, characters 8-24:
1 | let _ = 0xc.d5e6fp+1_24s;;
^^^^^^^^^^^^^^^^
Error: Unknown modifier 's' for literal 0xc.d5e6fp+1_24s
Error: Found 32-bit float literal 0xc.d5e6fp+1_24s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let () =
Expand All @@ -99,5 +99,21 @@ let () =
Line 2, characters 8-12:
2 | match 0.0s with
^^^^
Error: Unknown modifier 's' for literal 0.0s
Error: Found 32-bit float literal 0.0s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = #1.0s;;
[%%expect{|
Line 1, characters 8-13:
1 | let _ = #1.0s;;
^^^^^
Error: Found 32-bit float literal #1.0s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;

let _ = -#1.0s;;
[%%expect{|
Line 1, characters 8-14:
1 | let _ = -#1.0s;;
^^^^^^
Error: Found 32-bit float literal -#1.0s, but float32 is not enabled. You must enable -extension small_numbers to use this feature.
|}];;
6 changes: 3 additions & 3 deletions ocaml/testsuite/tests/typing-small-numbers/test_enabled.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ let () =
;;
[%%expect{|
Line 1:
Error: Matching on float32 is not supported.
Error: float32 literal patterns are not supported.
|}];;

let () =
Expand All @@ -86,7 +86,7 @@ let () =
;;
[%%expect{|
Line 1:
Error: Matching on float32 is not supported.
Error: float32 literal patterns are not supported.
|}];;

let () =
Expand All @@ -95,5 +95,5 @@ let () =
;;
[%%expect{|
Line 1:
Error: Matching on float32 is not supported.
Error: float32 literal patterns are not supported.
|}];;
2 changes: 1 addition & 1 deletion ocaml/toplevel/byte/dune
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(rule
(targets bytetop)
; This should be generated from the stdlib modules files
(action (run %{ocaml_where}/../../bin/ocamlrun -I ../../../external/float32 %{exe:../expunge.bc} %{dep:../topstart.bc} %{targets}
(action (run %{ocaml_where}/../../bin/ocamlrun %{exe:../expunge.bc} %{dep:../topstart.bc} %{targets}
stdlib__Arg
stdlib__Array
stdlib__ArrayLabels
Expand Down
2 changes: 1 addition & 1 deletion ocaml/typing/parmatch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2467,7 +2467,7 @@ let check_ambiguous_bindings =
ignore (List.fold_left check_case [] cases)

let report_error ppf = function
| Float32_match -> Format.pp_print_string ppf "Matching on float32 is not supported."
| Float32_match -> Format.pp_print_string ppf "float32 literal patterns are not supported."

let () =
Location.register_error_of_exn (function
Expand Down
15 changes: 11 additions & 4 deletions ocaml/typing/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ type error =
| Extension_not_enabled : _ Language_extension.t -> error
| Literal_overflow of string
| Unknown_literal of string * char
| Float32_literal of string
| Illegal_letrec_pat
| Illegal_letrec_expr
| Illegal_class_expr
Expand Down Expand Up @@ -690,9 +691,9 @@ let constant : Parsetree.constant -> (Typedtree.constant, error) result =
| Pconst_char c -> Ok (Const_char c)
| Pconst_string (s,loc,d) -> Ok (Const_string (s,loc,d))
| Pconst_float (f,None)-> Ok (Const_float f)
| Pconst_float (f,Some 's')
when Language_extension.is_enabled Small_numbers ->
Ok (Const_float32 f)
| Pconst_float (f,Some 's') ->
if Language_extension.is_enabled Small_numbers then Ok (Const_float32 f)
else Error (Float32_literal f)
| Pconst_float (f,Some c) -> Error (Unknown_literal (f, c))

let constant_or_raise env loc cst =
Expand All @@ -703,8 +704,11 @@ let constant_or_raise env loc cst =
let unboxed_constant : Jane_syntax.Layouts.constant -> (Typedtree.constant, error) result
= function
| Float (f, None) -> Ok (Const_unboxed_float f)
| Float (x, Some c) ->
| Float (f, Some 's') ->
(* CR mslater: (float32) unboxed *)
if Language_extension.is_enabled Small_numbers then assert false
else Error (Float32_literal (Misc.format_as_unboxed_literal f))
| Float (x, Some c) ->
Error (Unknown_literal (Misc.format_as_unboxed_literal x, c))
| Integer (i, suffix) ->
begin match constant_integer i ~suffix with
Expand Down Expand Up @@ -9991,6 +9995,9 @@ let report_error ~loc env = function
ty
| Unknown_literal (n, m) ->
Location.errorf ~loc "Unknown modifier '%c' for literal %s%c" m n m
| Float32_literal f ->
Location.errorf ~loc "Found 32-bit float literal %ss, but float32 is not enabled. \
You must enable -extension small_numbers to use this feature." f
| Illegal_letrec_pat ->
Location.errorf ~loc
"Only variables are allowed as left-hand side of `let rec'"
Expand Down
3 changes: 2 additions & 1 deletion ocaml/typing/typecore.mli
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ type error =
| Extension_not_enabled : _ Language_extension.t -> error
| Literal_overflow of string
| Unknown_literal of string * char
| Float32_literal of string
| Illegal_letrec_pat
| Illegal_letrec_expr
| Illegal_class_expr
Expand Down Expand Up @@ -329,4 +330,4 @@ val check_recursive_bindings : Env.t -> Typedtree.value_binding list -> unit
val check_recursive_class_bindings :
Env.t -> Ident.t list -> Typedtree.class_expr list -> unit

val src_pos : Location.t -> Typedtree.attributes -> Env.t -> Typedtree.expression
val src_pos : Location.t -> Typedtree.attributes -> Env.t -> Typedtree.expression
3 changes: 2 additions & 1 deletion ocaml/typing/typeopt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ let classify_lazy_argument : Typedtree.expression ->
|`Other] =
fun e -> match e.exp_desc with
| Texp_constant
( Const_int _ | Const_char _ | Const_string _ | Const_float32 _
( Const_int _ | Const_char _ | Const_string _
| Const_float32 _ (* There is no float32 array optimization *)
| Const_int32 _ | Const_int64 _ | Const_nativeint _ )
| Texp_function _
| Texp_construct (_, {cstr_arity = 0}, _, _) ->
Expand Down
5 changes: 2 additions & 3 deletions testsuite/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ expect_MAIN=expect_test
expect_PROG=$(expect_MAIN)$(EXE)
expect_DIRS = parsing utils driver typing toplevel
expect_OCAMLFLAGS = $(addprefix -I $(ROOTDIR)/,$(expect_DIRS))
expect_LIBS := $(ROOTDIR)/external/compiler_float32 \
$(addprefix $(COMPILERLIBSDIR)/,\
ocamlcommon ocamlbytecomp ocamltoplevel)
expect_LIBS := $(addprefix $(COMPILERLIBSDIR)/,\
ocamlcommon ocamlbytecomp ocamltoplevel)

codegen_PROG = codegen$(EXE)
codegen_DIRS = parsing utils typing middle_end bytecomp lambda asmcomp
Expand Down
Loading