Skip to content
1 change: 1 addition & 0 deletions src/analysis/construct.ml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ module Gen = struct
List.map choices ~f:(fun choice ->
Ast_helper.Exp.unboxed_tuple choice)
| Tvariant row_desc -> variant env rtyp row_desc
| Tquote _ | Tsplice _ -> []
| Tpackage (path, lids_args) -> begin
let open Ast_helper in
try
Expand Down
2 changes: 2 additions & 0 deletions src/analysis/ptyp_of_type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ and core_type type_expr =
in
Typ.poly names @@ core_type type_expr
| Tof_kind _jkind -> (* CR modes: this is terrible *) Typ.any None
| Tquote type_expr -> Typ.quote (core_type type_expr)
| Tsplice type_expr -> Typ.splice (core_type type_expr)
| Tpackage (path, lids_type_exprs) ->
let loc = mknoloc (Untypeast.lident_of_path path) in
let args =
Expand Down
11 changes: 8 additions & 3 deletions src/analysis/syntax_doc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ let get_mode_doc mode =
Some "Functions with this mode can read but not write mutable data"
| Comonadic Statefulness, Stateless ->
Some "Functions with this mode cannot access mutable data"
| Comonadic Forkable, Forkable ->
Some "Values with this mode can be forked to other threads"
| Comonadic Forkable, Unforkable ->
Some "Values with this mode cannot be forked to other threads"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Claude's made these decriptions up, I'm not sure if they're correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll chase someone down to write something here because I'm not sure either.

in
let doc_url =
let subpage =
Expand All @@ -271,6 +275,7 @@ let get_mode_doc mode =
| Comonadic Yielding -> "modes/intro/"
| Monadic Visibility -> "modes/intro/"
| Comonadic Statefulness -> "modes/intro/"
| Comonadic Forkable -> "modes/intro/"
in
syntax_doc_url Oxcaml subpage
in
Expand Down Expand Up @@ -641,16 +646,16 @@ let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
get_modality_doc modality
| _ -> get_modality_doc modality)
(* Jkinds *)
| Jkind_annotation { pjkind_desc = Abbreviation abbrev; _ } :: _ ->
| Jkind_annotation { pjkind_desc = Pjk_abbreviation abbrev; _ } :: _ ->
get_jkind_abbrev_doc abbrev
| Jkind_annotation { pjkind_desc = Mod _; _ } :: _ ->
| Jkind_annotation { pjkind_desc = Pjk_mod _; _ } :: _ ->
Some
{ name = "`mod` keyword (in a kind)";
description = "Types of this kind will cross the following modes";
documentation = syntax_doc_url Oxcaml "kinds/intro/";
level = Advanced
}
| Jkind_annotation { pjkind_desc = With (_, with_type, _); _ } :: _ -> (
| Jkind_annotation { pjkind_desc = Pjk_with (_, with_type, _); _ } :: _ -> (
match compare_cursor_to_loc with_type.ptyp_loc with
| Before ->
Some
Expand Down
5 changes: 4 additions & 1 deletion src/analysis/tail_analysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ let expr_tail_positions = function
| Texp_setmutvar _
| Texp_idx _
| Texp_atomic_loc _
| Texp_hole _ -> []
| Texp_hole _
| Texp_quotation _
| Texp_antiquotation _
| Texp_eval _ -> []
| Texp_match (_, _, cs, _) -> List.map cs ~f:(fun c -> Case c)
| Texp_try (_, cs) -> List.map cs ~f:(fun c -> Case c)
| Texp_letmodule (_, _, _, _, e)
Expand Down
15 changes: 10 additions & 5 deletions src/ocaml/merlin_specific/browse_raw.ml
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ let rec of_expression_desc loc = function
of_block_access block_access ** list_fold of_unboxed_access unboxed_access
| Texp_atomic_loc (exp, _, _, _, _) -> of_expression exp
| Texp_hole _ -> id_fold
| Texp_quotation exp -> of_expression exp
| Texp_antiquotation exp -> of_expression exp
| Texp_eval (ct, _) -> of_core_type ct

(* We should consider taking into account param.fp_loc at some point, as it
allows us to respond with the *parameter*'s type (as opposed to the
Expand Down Expand Up @@ -645,6 +648,8 @@ and of_core_type_desc = function
of_core_type ct ** of_jkind_annotation_opt jkind
| Ttyp_variant (rfs, _, _) -> list_fold (fun rf -> app (Row_field rf)) rfs
| Ttyp_package pt -> app (Package_type pt)
| Ttyp_quote ct -> of_core_type ct
| Ttyp_splice ct -> of_core_type ct

and of_class_type_desc = function
| Tcty_constr (_, _, cts) -> list_fold of_core_type cts
Expand All @@ -671,13 +676,13 @@ let of_jkind_annotation_desc : Parsetree.jkind_annotation_desc -> _ =
id_fold
in
function
| Default | Abbreviation _ -> id_fold
| Mod (jkind, modes) -> of_jkind_annotation jkind ** list_fold of_mode modes
| With (jkind, ct, modalities) ->
| Pjk_default | Pjk_abbreviation _ -> id_fold
| Pjk_mod (jkind, modes) -> of_jkind_annotation jkind ** list_fold of_mode modes
| Pjk_with (jkind, ct, modalities) ->
of_jkind_annotation jkind ** of_core_type ct
** list_fold of_modality modalities
| Kind_of ct -> of_core_type ct
| Product jkinds -> list_fold of_jkind_annotation jkinds
| Pjk_kind_of ct -> of_core_type ct
| Pjk_product jkinds -> list_fold of_jkind_annotation jkinds

let of_attribute (attr : attribute) =
let name = attr.attr_name.txt in
Expand Down
3 changes: 3 additions & 0 deletions src/ocaml/parsing/pprintast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2539,6 +2539,9 @@ let prepare_error err =
Location.errorf ~source ~loc
"Syntax error: `%s` is reserved for use in runtime metaprogramming."
symb
| Unspliceable loc ->
Location.errorf ~source ~loc
"Syntax error: This expression cannot be spliced."
| Let_mutable_not_allowed_at_structure_level loc ->
Location.errorf ~source ~loc
"Syntax error: Mutable let bindings are not allowed \
Expand Down
2 changes: 2 additions & 0 deletions src/ocaml/parsing/syntaxerr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type error =
| Removed_string_set of Location.t
| Missing_unboxed_literal_suffix of Location.t
| Malformed_instance_identifier of Location.t
| Quotation_reserved of Location.t * string
| Unspliceable of Location.t
| Let_mutable_not_allowed_at_structure_level of Location.t
| Let_mutable_not_allowed_in_class_definition of Location.t
Expand All @@ -56,6 +57,7 @@ let location_of_error = function
| Removed_string_set l -> l
| Missing_unboxed_literal_suffix l -> l
| Malformed_instance_identifier l -> l
| Quotation_reserved (l, _) -> l
| Unspliceable l -> l
| Let_mutable_not_allowed_at_structure_level l -> l
| Let_mutable_not_allowed_in_class_definition l -> l
Expand Down
1 change: 1 addition & 0 deletions src/ocaml/parsing/syntaxerr.mli
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type error =
| Removed_string_set of Location.t
| Missing_unboxed_literal_suffix of Location.t
| Malformed_instance_identifier of Location.t
| Quotation_reserved of Location.t * string
| Unspliceable of Location.t
| Let_mutable_not_allowed_at_structure_level of Location.t
| Let_mutable_not_allowed_in_class_definition of Location.t
Expand Down
8 changes: 6 additions & 2 deletions src/ocaml/preprocess/parser_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ let print_symbol = function
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_strict_function_or_labeled_tuple_type) -> "strict_function_or_labeled_tuple_type"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_strict_binding_modes) -> "strict_binding_modes"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_str_exception_declaration) -> "str_exception_declaration"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_spliceable_type) -> "spliceable_type"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_spliceable_expr) -> "spliceable_expr"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_single_attr_id) -> "single_attr_id"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_simple_pattern_not_ident) -> "simple_pattern_not_ident"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_simple_pattern_extend_modes_or_poly) -> "simple_pattern_extend_modes_or_poly"
Expand Down Expand Up @@ -326,7 +328,7 @@ let print_symbol = function
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_type_trailing_no_hash_) -> "mk_longident_mod_ext_longident_type_trailing_no_hash_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_type_trailing_hash_) -> "mk_longident_mod_ext_longident_type_trailing_hash_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_ident_) -> "mk_longident_mod_ext_longident_ident_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident___anonymous_50_) -> "mk_longident_mod_ext_longident___anonymous_50_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident___anonymous_51_) -> "mk_longident_mod_ext_longident___anonymous_51_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_UIDENT_) -> "mk_longident_mod_ext_longident_UIDENT_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_LIDENT_) -> "mk_longident_mod_ext_longident_LIDENT_"
| MenhirInterpreter.X (MenhirInterpreter.N MenhirInterpreter.N_method_) -> "method_"
Expand Down Expand Up @@ -619,6 +621,8 @@ let print_value (type a) : a MenhirInterpreter.symbol -> a -> string = function
| MenhirInterpreter.N MenhirInterpreter.N_strict_function_or_labeled_tuple_type -> (fun _ -> "strict_function_or_labeled_tuple_type")
| MenhirInterpreter.N MenhirInterpreter.N_strict_binding_modes -> (fun _ -> "strict_binding_modes")
| MenhirInterpreter.N MenhirInterpreter.N_str_exception_declaration -> (fun _ -> "str_exception_declaration")
| MenhirInterpreter.N MenhirInterpreter.N_spliceable_type -> (fun _ -> "spliceable_type")
| MenhirInterpreter.N MenhirInterpreter.N_spliceable_expr -> (fun _ -> "spliceable_expr")
| MenhirInterpreter.N MenhirInterpreter.N_single_attr_id -> (fun _ -> "single_attr_id")
| MenhirInterpreter.N MenhirInterpreter.N_simple_pattern_not_ident -> (fun _ -> "simple_pattern_not_ident")
| MenhirInterpreter.N MenhirInterpreter.N_simple_pattern_extend_modes_or_poly -> (fun _ -> "simple_pattern_extend_modes_or_poly")
Expand Down Expand Up @@ -743,7 +747,7 @@ let print_value (type a) : a MenhirInterpreter.symbol -> a -> string = function
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_type_trailing_no_hash_ -> (fun _ -> "mk_longident_mod_ext_longident_type_trailing_no_hash_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_type_trailing_hash_ -> (fun _ -> "mk_longident_mod_ext_longident_type_trailing_hash_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_ident_ -> (fun _ -> "mk_longident_mod_ext_longident_ident_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident___anonymous_50_ -> (fun _ -> "mk_longident_mod_ext_longident___anonymous_50_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident___anonymous_51_ -> (fun _ -> "mk_longident_mod_ext_longident___anonymous_51_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_UIDENT_ -> (fun _ -> "mk_longident_mod_ext_longident_UIDENT_")
| MenhirInterpreter.N MenhirInterpreter.N_mk_longident_mod_ext_longident_LIDENT_ -> (fun _ -> "mk_longident_mod_ext_longident_LIDENT_")
| MenhirInterpreter.N MenhirInterpreter.N_method_ -> (fun _ -> "method_")
Expand Down
Loading