Skip to content

Commit

Permalink
update all vendored
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Apr 21, 2024
1 parent b6d8c75 commit e0d5147
Show file tree
Hide file tree
Showing 74 changed files with 1,390 additions and 1,403 deletions.
3 changes: 1 addition & 2 deletions src/ml/GenerateSchemaUtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ let formatCode ~debug code =
~displayFilename:"Schema.res"
in
let printed =
Res_printer.printImplementation ~width:!Res_cli.ResClflags.width ~comments
structure
Res_printer.printImplementation ~width:100 ~comments structure
in
if List.length diagnostics > 0 then
if debug then
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/expected/Schema.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hover tests/Schema.res 44:12
{"status": "Hover", "item": {"contents": {"kind": "markdown", "value": "GraphQL enum generated by ResGraph:\n```graphql\n\n\"\"\"Indicates what status a user currently has.\"\"\"\nenum UserStatus {\n\n \"\"\"User is online.\"\"\"\n ONLINE\n\n \"\"\"User is offline.\"\"\"\n Offline\n\n \"\"\"User is idle.\"\"\"\n Idle @deprecated(reason: \"Use 'Offline' instead. This should be \\\"escaped\\\".\")\n}\n```"}}}
Hover tests/Schema.res 80:6
{"status": "Hover", "item": {"contents": {"kind": "markdown", "value": "GraphQL input object generated by ResGraph:\n```graphql\n\n\"\"\"Additional for searching for a user.\"\"\"\ninput UserConfigContext {\n groupId: String\n name: String\n}\n```"}}}
Hover tests/Schema.res 192:7
Hover tests/Schema.res 191:7
{"status": "Hover", "item": {"contents": {"kind": "markdown", "value": "GraphQL object type field generated by ResGraph:\n```graphql\ntype Mutation {\n addUser(name: String!): User\n}\n```"}}}
generating schema from ./src/

Expand Down Expand Up @@ -1164,5 +1164,5 @@ union_UserOrGroup.contents = GraphQLUnionType.make({
let schema = GraphQLSchemaType.make({"query": get_Query(), "mutation": get_Mutation()})


Hover tests/Schema.res 238:10
Hover tests/Schema.res 237:10
{"status": "Hover", "item": null}
8 changes: 4 additions & 4 deletions vendor/ext/bsc_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ let stop_raise ~usage ~(error : error) (speclist : t) =
Ext_buffer.output_buffer stdout b;
exit 0
| Unknown s ->
b +> "unknown option: '";
b +> "Unknown option \"";
b +> s;
b +> "'.\n"
b +> "\".\n"
| Missing s ->
b +> "option '";
b +> "Option \"";
b +> s;
b +> "' needs an argument.\n");
b +> "\" needs an argument.\n");
usage_b b ~usage speclist;
bad_arg (Ext_buffer.contents b)

Expand Down
1 change: 1 addition & 0 deletions vendor/ext/bsc_warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
- 102 Bs_polymorphic_comparison
*)
(* If you change this, don't forget to adapt docs/docson/build-schema.json as well. *)
let defaults_w = "+a-4-9-20-40-41-42-50-61-102"

let defaults_warn_error = "-a+5+6+101+109"
Expand Down
4 changes: 1 addition & 3 deletions vendor/ext/ext_js_file_kind.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
type case = Upper | Little

type [@warning "-69"] t = { case : case; suffix : Ext_js_suffix.t }

let any_runtime_kind = { case = Little; suffix = Ext_js_suffix.Js }
type [@warning "-69"] t = { case : case; suffix : string }
28 changes: 0 additions & 28 deletions vendor/ext/ext_js_suffix.ml

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/ext/ext_module_system.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
type t = NodeJS | Es6 | Es6_global
type t = Commonjs | Esmodule | Es6_global
2 changes: 1 addition & 1 deletion vendor/ext/ext_namespace.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let js_name_of_modulename s (case : Ext_js_file_kind.case) suffix : string =
let s =
match case with Little -> Ext_string.uncapitalize_ascii s | Upper -> s
in
change_ext_ns_suffix s (Ext_js_suffix.to_string suffix)
change_ext_ns_suffix s suffix

(* https://docs.npmjs.com/files/package.json
Some rules:
Expand Down
2 changes: 1 addition & 1 deletion vendor/ext/ext_namespace.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ val try_split_module_name : string -> (string * string) option
val change_ext_ns_suffix : string -> string -> string

val js_name_of_modulename :
string -> Ext_js_file_kind.case -> Ext_js_suffix.t -> string
string -> Ext_js_file_kind.case -> string -> string
(** [js_name_of_modulename ~little A-Ns]
*)

Expand Down
1 change: 0 additions & 1 deletion vendor/ext/ext_string.ml
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,3 @@ let hash_number_as_i32_exn
let first_marshal_char (x : string) =
x <> "" &&
( String.unsafe_get x 0 = '\132')

2 changes: 1 addition & 1 deletion vendor/ext/ext_string.mli
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ val hash_number_as_i32_exn:

val first_marshal_char:
string ->
bool
bool
1 change: 1 addition & 0 deletions vendor/ext/js_reserved_map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ let sorted_keywords = [|
"DecompressionStream";
"DelayNode";
"DelegatedInkTrailPresenter";
"Deno";
"Document";
"DocumentFragment";
"DocumentPictureInPictureEvent";
Expand Down
2 changes: 2 additions & 0 deletions vendor/ext/js_runtime_modules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ let md5 = "Caml_md5"

let int32 = "Caml_int32"

let bigint = "Caml_bigint"

let option = "Caml_option"

let module_ = "Caml_module"
Expand Down
14 changes: 4 additions & 10 deletions vendor/ext/literals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,19 @@ let suffix_d = ".d"

let suffix_js = ".js"

let suffix_bs_js = ".bs.js"

let suffix_mjs = ".mjs"

let suffix_bs_mjs = ".bs.mjs"

let suffix_cjs = ".cjs"

let suffix_bs_cjs = ".bs.cjs"

let suffix_gen_js = ".gen.js"

let suffix_gen_tsx = ".gen.tsx"

let esmodule = "esmodule"

let commonjs = "commonjs"

let es6 = "es6"
[@@ocaml.deprecated "Will be removed in v12"]

let es6_global = "es6-global"
[@@ocaml.deprecated "Will be removed in v12"]

let unused_attribute = "Unused attribute "

Expand Down
1 change: 0 additions & 1 deletion vendor/ext/misc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ module Int_literal_converter = struct
let int s = cvt_int_aux s (~-) int_of_string
let int32 s = cvt_int_aux s Int32.neg Int32.of_string
let int64 s = cvt_int_aux s Int64.neg Int64.of_string
let nativeint s = cvt_int_aux s Nativeint.neg Nativeint.of_string
end

(* String operations *)
Expand Down
1 change: 0 additions & 1 deletion vendor/ext/misc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ module Int_literal_converter : sig
val int : string -> int
val int32 : string -> int32
val int64 : string -> int64
val nativeint : string -> nativeint
end

val chop_extensions: string -> string
Expand Down
9 changes: 8 additions & 1 deletion vendor/ext/warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type t =
| Bs_integer_literal_overflow (* 107 *)
| Bs_uninterpreted_delimiters of string (* 108 *)
| Bs_toplevel_expression_unit of (string * topLevelUnitHelp) option (* 109 *)
| Bs_todo of string option (* 110 *)

(* If you remove a warning, leave a hole in the numbering. NEVER change
the numbers of existing warnings.
Expand Down Expand Up @@ -151,6 +152,7 @@ let number = function
| Bs_integer_literal_overflow -> 107
| Bs_uninterpreted_delimiters _ -> 108
| Bs_toplevel_expression_unit _ -> 109
| Bs_todo _ -> 110

let last_warning_number = 110

Expand Down Expand Up @@ -509,6 +511,11 @@ let message = function
| Other -> "yourExpression") in
Printf.sprintf "\n\n Possible solutions:\n - Assigning to a value that is then ignored: `let _ = %s`\n - Piping into the built-in ignore function to ignore the result: `%s->ignore`" helpText helpText
| _ -> "")
| Bs_todo maybe_text -> (
match maybe_text with
| None -> "Todo found."
| Some todo -> "Todo found: " ^ todo
) ^ "\n\n This code is not implemented yet and will crash at runtime. Make sure you implement this before running the code."

let sub_locs = function
| Deprecated (_, def, use) ->
Expand Down Expand Up @@ -640,7 +647,7 @@ let descriptions =
);
(108, "Uninterpreted delimiters (for unicode)");
(109, "Toplevel expression has unit type");
(110, "Expression has nested promise type");
(110, "Todo found");
]

let help_warnings () =
Expand Down
1 change: 1 addition & 0 deletions vendor/ext/warnings.mli
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type t =
| Bs_integer_literal_overflow (* 107 *)
| Bs_uninterpreted_delimiters of string (* 108 *)
| Bs_toplevel_expression_unit of (string * topLevelUnitHelp) option (* 109 *)
| Bs_todo of string option (* 110 *)

val parse_options : bool -> string -> unit

Expand Down
1 change: 1 addition & 0 deletions vendor/ml/.ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable
18 changes: 12 additions & 6 deletions vendor/ml/ast_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ let add_promise_type ?(loc = Location.none) ~async

let add_async_attribute ~async (body : Parsetree.expression) =
if async then
{
body with
pexp_attributes =
({txt = "res.async"; loc = Location.none}, PStr [])
:: body.pexp_attributes;
}
(
match body.pexp_desc with
| Pexp_construct (x, Some e) when Ast_uncurried.exprIsUncurriedFun body ->
{body with pexp_desc = Pexp_construct (x, Some {e with pexp_attributes =
({txt = "res.async"; loc = Location.none}, PStr []) :: e.pexp_attributes} )}
| _ ->
{
body with
pexp_attributes =
({txt = "res.async"; loc = Location.none}, PStr [])
:: body.pexp_attributes;
})
else body

let rec add_promise_to_result ~loc (e : Parsetree.expression) =
Expand Down
2 changes: 1 addition & 1 deletion vendor/ml/ast_await.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let is_await : Parsetree.attribute -> bool =
fun ({txt}, _) -> txt = "await" || txt = "res.await"

let create_await_expression (e : Parsetree.expression) =
let loc = e.pexp_loc in
let loc = {e.pexp_loc with loc_ghost = true} in
let unsafe_await =
Ast_helper.Exp.ident ~loc
{txt = Ldot (Ldot (Lident "Js", "Promise"), "unsafe_await"); loc}
Expand Down
18 changes: 16 additions & 2 deletions vendor/ml/ast_payload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ let is_single_int (x : t) : int option =
{
pstr_desc =
Pstr_eval
({pexp_desc = Pexp_constant (Pconst_integer (name, _)); _}, _);
({pexp_desc = Pexp_constant (Pconst_integer (name, char)); _}, _);
_;
};
] ->
] when (match char with Some n when n = 'n' -> false | _ -> true) ->
Some (int_of_string name)
| _ -> None

Expand All @@ -82,6 +82,20 @@ let is_single_float (x : t) : string option =
Some name
| _ -> None

let is_single_bigint (x : t) : string option =
match x with
| PStr
[
{
pstr_desc =
Pstr_eval
({pexp_desc = Pexp_constant (Pconst_integer (name, Some 'n')); _}, _);
_;
};
] ->
Some name
| _ -> None

let is_single_bool (x : t) : bool option =
match x with
| PStr
Expand Down
2 changes: 2 additions & 0 deletions vendor/ml/ast_payload.mli
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ val is_single_int : t -> int option

val is_single_float : t -> string option

val is_single_bigint : t -> string option

val is_single_bool : t -> bool option

val is_single_ident : t -> Longident.t option
Expand Down
15 changes: 12 additions & 3 deletions vendor/ml/ast_uncurried.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,20 @@ let coreTypeIsUncurriedFun (typ : Parsetree.core_type) =
true
| _ -> false

let typeIsUncurriedFun = Ast_uncurried_utils.typeIsUncurriedFun

let typeExtractUncurriedFun (typ : Parsetree.core_type) =
let coreTypeExtractUncurriedFun (typ : Parsetree.core_type) =
match typ.ptyp_desc with
| Ptyp_constr ({txt = Lident "function$"}, [tArg; tArity]) ->
(arityFromType tArity, tArg)
| _ -> assert false

let typeIsUncurriedFun = Ast_uncurried_utils.typeIsUncurriedFun

let typeExtractUncurriedFun (typ : Types.type_expr) =
match typ.desc with
| Tconstr (Pident {name = "function$"}, [tArg; _], _) ->
tArg
| _ -> assert false

(* Typed AST *)

let arity_to_type arity =
Expand Down Expand Up @@ -114,3 +120,6 @@ let uncurried_type_get_arity_opt ~env typ =
| Tconstr (Pident { name = "function$" }, [ _t; tArity ], _) ->
Some (type_to_arity tArity)
| _ -> None



Loading

0 comments on commit e0d5147

Please sign in to comment.