@@ -25,6 +25,8 @@ open Lambda
25
25
type error =
26
26
Non_value_layout of type_expr * Layout.Violation .t option
27
27
| Non_value_sort of Sort .t * type_expr
28
+ | Sort_without_extension of
29
+ Sort .t * Language_extension .maturity * type_expr option
28
30
| Non_value_sort_unknown_ty of Sort .t
29
31
30
32
exception Error of Location. t * error
@@ -565,15 +567,17 @@ let layout env loc sort ty =
565
567
| Value -> Lambda. Pvalue (value_kind env loc ty)
566
568
| Float64 when Language_extension. (is_at_least Layouts Beta ) ->
567
569
Lambda. Punboxed_float
568
- | Float64 -> raise (Error (loc, Non_value_sort (Sort. float64,ty)))
570
+ | Float64 ->
571
+ raise (Error (loc, Sort_without_extension (Sort. float64, Beta , Some ty)))
569
572
| Void -> raise (Error (loc, Non_value_sort (Sort. void,ty)))
570
573
571
574
let layout_of_sort loc sort =
572
575
match Layouts.Sort. get_default_value sort with
573
576
| Value -> Lambda. Pvalue Pgenval
574
577
| Float64 when Language_extension. (is_at_least Layouts Beta ) ->
575
578
Lambda. Punboxed_float
576
- | Float64 -> raise (Error (loc, Non_value_sort_unknown_ty Sort. float64))
579
+ | Float64 ->
580
+ raise (Error (loc, Sort_without_extension (Sort. float64, Beta , None )))
577
581
| Void -> raise (Error (loc, Non_value_sort_unknown_ty Sort. void))
578
582
579
583
let layout_of_const_sort (s : Layouts.Sort.const ) =
@@ -681,6 +685,18 @@ let report_error ppf = function
681
685
" Non-value layout %a detected in [layout_of_sort]@ Please report this \
682
686
error to the Jane Street compilers team."
683
687
Sort. format sort
688
+ | Sort_without_extension (sort , maturity , ty ) ->
689
+ fprintf ppf " Non-value layout %a detected" Sort. format sort;
690
+ begin match ty with
691
+ | None -> ()
692
+ | Some ty -> fprintf ppf " as sort for type@ %a" Printtyp. type_expr ty
693
+ end ;
694
+ fprintf ppf
695
+ " ,@ but this requires extension %s, which is not enabled.@ \
696
+ If you intended to use this layout, please add this flag to your \
697
+ build file.@ \
698
+ Otherwise, please report this error to the Jane Street compilers team."
699
+ (Language_extension. to_command_line_string Layouts maturity)
684
700
685
701
let () =
686
702
Location. register_error_of_exn
0 commit comments