Skip to content

Commit

Permalink
Move float# (and immediate) into Stable
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfirere committed Nov 2, 2023
1 parent 176d93b commit 7314d38
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ocaml/parsing/builtin_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ let jkind ~legacy_immediate attrs =
| Value -> check true
| Immediate | Immediate64 ->
check (legacy_immediate
|| Language_extension.(is_at_least Layouts Beta))
|| Language_extension.(is_at_least Layouts Stable))
| Any | Float64 ->
check Language_extension.(is_at_least Layouts Beta)
check Language_extension.(is_at_least Layouts Stable)
| Void ->
check Language_extension.(is_at_least Layouts Alpha)

Expand Down
2 changes: 1 addition & 1 deletion ocaml/parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ let unboxed_float sloc sign (f, m) =

let assert_unboxed_float_type ~loc =
Language_extension.(
Jane_syntax_parsing.assert_extension_enabled ~loc Layouts Beta)
Jane_syntax_parsing.assert_extension_enabled ~loc Layouts Stable)

let unboxed_float_type sloc tys =
assert_unboxed_float_type ~loc:(make_loc sloc);
Expand Down
3 changes: 1 addition & 2 deletions ocaml/typing/jkind.ml
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ let raise ~loc err = raise (User_error (loc, err))
let get_required_layouts_level (context : annotation_context) (jkind : const) :
Language_extension.maturity =
match context, jkind with
| _, Value -> Stable
| _, (Immediate | Immediate64 | Any | Float64) -> Beta
| _, (Value | Immediate | Immediate64 | Any | Float64) -> Stable
| _, Void -> Alpha

(******************************)
Expand Down
10 changes: 5 additions & 5 deletions ocaml/typing/typeopt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -564,25 +564,25 @@ let value_kind env loc ty =
let layout env loc sort ty =
match Jkind.Sort.get_default_value sort with
| Value -> Lambda.Pvalue (value_kind env loc ty)
| Float64 when Language_extension.(is_at_least Layouts Beta) ->
| Float64 when Language_extension.(is_at_least Layouts Stable) ->
Lambda.Punboxed_float
| Float64 ->
raise (Error (loc, Sort_without_extension (Jkind.Sort.float64, Beta, Some ty)))
raise (Error (loc, Sort_without_extension (Jkind.Sort.float64, Stable, Some ty)))
| Void -> raise (Error (loc, Non_value_sort (Jkind.Sort.void,ty)))

let layout_of_sort loc sort =
match Jkind.Sort.get_default_value sort with
| Value -> Lambda.Pvalue Pgenval
| Float64 when Language_extension.(is_at_least Layouts Beta) ->
| Float64 when Language_extension.(is_at_least Layouts Stable) ->
Lambda.Punboxed_float
| Float64 ->
raise (Error (loc, Sort_without_extension (Jkind.Sort.float64, Beta, None)))
raise (Error (loc, Sort_without_extension (Jkind.Sort.float64, Stable, None)))
| Void -> raise (Error (loc, Non_value_sort_unknown_ty Jkind.Sort.void))

let layout_of_const_sort (s : Jkind.Sort.const) =
match s with
| Value -> Lambda.Pvalue Pgenval
| Float64 when Language_extension.(is_at_least Layouts Beta) ->
| Float64 when Language_extension.(is_at_least Layouts Stable) ->
Lambda.Punboxed_float
| Float64 -> Misc.fatal_error "layout_of_const_sort: float64 encountered"
| Void -> Misc.fatal_error "layout_of_const_sort: void encountered"
Expand Down

1 comment on commit 7314d38

@ncik-roberts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

Please sign in to comment.