diff --git a/changes/stale-compiler-comments.internal.md b/changes/stale-compiler-comments.internal.md new file mode 100644 index 0000000000..9306a97cf2 --- /dev/null +++ b/changes/stale-compiler-comments.internal.md @@ -0,0 +1 @@ +- Fix stale comments in the compiler and the `Private_label` entry of the error variant catalog. https://github.com/rescript-lang/rescript/pull/8851 diff --git a/compiler/core/lam_compile_primitive.ml b/compiler/core/lam_compile_primitive.ml index 8a1c118929..b358d26204 100644 --- a/compiler/core/lam_compile_primitive.ml +++ b/compiler/core/lam_compile_primitive.ml @@ -663,7 +663,6 @@ let translate output_prefix loc (cxt : Lam_compile_context.t) ~callee:(Lam_compile_external_call.jsx_callee jsx_ffi) ~tag ~spread ~props ~children ~key ~multi:jsx_multi ~fragment:jsx_fragment) - (* FIXME, this can be removed later *) | Pis_poly_var_block -> E.is_type_object (Ext_list.singleton_exn args) | Pduprecord -> ( match args with diff --git a/compiler/ml/clflags.ml b/compiler/ml/clflags.ml index f5da859e5b..af9e100371 100644 --- a/compiler/ml/clflags.ml +++ b/compiler/ml/clflags.ml @@ -2,7 +2,7 @@ let output_name = ref (None : string option) (* -o *) and include_dirs = ref ([] : string list) (* -I *) -and debug = ref false (* -g *) +and debug = ref false (* set in Bs_conditional_initial *) and nopervasives = ref false (* -nopervasives *) @@ -19,7 +19,7 @@ and open_modules = ref [] (* -open *) and real_paths = ref true (* -short-paths *) -and transparent_modules = ref false (* -trans-mod *) +and transparent_modules = ref false (* -no-alias-deps *) let dump_source = ref false (* -dsource *) let dump_parsetree = ref false (* -dparsetree *) diff --git a/compiler/ml/clflags.mli b/compiler/ml/clflags.mli index 3efdf86127..2bc9acba1d 100644 --- a/compiler/ml/clflags.mli +++ b/compiler/ml/clflags.mli @@ -31,8 +31,9 @@ val assume_no_mli : mli_status ref val dont_record_crc_unit : string option ref val bs_gentype : bool ref +(* Keep JSX in the output ([-bs-jsx-preserve]); read by translcore, and by + js_dump through [Js_config] *) val jsx_preserve : bool ref -(* Keep JSX in the output ([-bs-jsx-preserve]); read by translcore *) val no_assert_false : bool ref val dump_location : bool ref diff --git a/compiler/ml/lambda.ml b/compiler/ml/lambda.ml index 581baa9ff2..57760bdf61 100644 --- a/compiler/ml/lambda.ml +++ b/compiler/ml/lambda.ml @@ -126,7 +126,7 @@ type eliminated = Identity | Ignore the spread props (if [jsx_spread]), one value per [jsx_props] entry, the children ([jsx_children] of them) and the key (if [jsx_key]). *) type jsx_element = { - jsx_name: string; (* name of the external, for the fallback call *) + jsx_name: string; (* name of the external, only printed by [Printlambda] *) jsx_ffi: External_ffi_types.external_decl; jsx_multi: bool; (* [jsxs]: each child is a separate argument *) jsx_fragment: bool; (* the tag is the JSX module's [jsxFragment] *) @@ -258,8 +258,6 @@ type primitive = | Phash_mixint | Phash_mixstring | Phash_finalmix - (* Test if the argument is a block or an immediate integer *) - (* Test if the (integer) argument is outside an interval *) (* Test if the argument is null or undefined *) | Pis_null_undefined (* exn *) diff --git a/compiler/ml/lambda.mli b/compiler/ml/lambda.mli index b215a69856..571568407e 100644 --- a/compiler/ml/lambda.mli +++ b/compiler/ml/lambda.mli @@ -127,7 +127,7 @@ type eliminated = Identity | Ignore the spread props (if [jsx_spread]), one value per [jsx_props] entry, the children ([jsx_children] of them) and the key (if [jsx_key]). *) type jsx_element = { - jsx_name: string; (* name of the external, for the fallback call *) + jsx_name: string; (* name of the external, only printed by [Printlambda] *) jsx_ffi: External_ffi_types.external_decl; jsx_multi: bool; (* [jsxs]: each child is a separate argument *) jsx_fragment: bool; (* the tag is the JSX module's [jsxFragment] *) diff --git a/compiler/ml/rec_check.ml b/compiler/ml/rec_check.ml index b2e7f2c924..c0c0909158 100644 --- a/compiler/ml/rec_check.ml +++ b/compiler/ml/rec_check.ml @@ -211,7 +211,8 @@ let rec classify_expression : Typedtree.expression -> sd = Static | Texp_apply {funct = {exp_desc = Texp_ident (_, _, vd)}} when is_ref vd -> Static - (* A dict is built by calls, see [Translcore] *) + (* A dict literal is built by the [Pmakedict] and [Pdict_spread] primitives, + see [Translcore] *) | Texp_apply _ | Texp_dict _ | Texp_match _ | Texp_ifthenelse _ | Texp_object_get _ | Texp_object_set _ | Texp_field _ | Texp_assert _ | Texp_try _ | Texp_tagged_template _ | Texp_template _ -> diff --git a/compiler/ml/typecore.ml b/compiler/ml/typecore.ml index 185ce00764..21e0ea2630 100644 --- a/compiler/ml/typecore.ml +++ b/compiler/ml/typecore.ml @@ -2648,9 +2648,9 @@ and type_expect_ ?deprecated_context ~context ?(recarg = Rejected) env sexp in (if should_unify_expected_result_before_typing_lowered_apply funct sargs then - (* Lowered syntax like dict literals and async wrappers becomes a regular - application, so thread the expected result type into the application - before typing its arguments. *) + (* The async wrapper is lowered to a regular application, so thread the + expected result type into the application before typing its + arguments. *) let _, ty_res = filter_arrow_n ~env funct.exp_type (List.map (fun _ -> Asttypes.Nolabel) sargs) diff --git a/compiler/syntax/src/res_parsetree_viewer.ml b/compiler/syntax/src/res_parsetree_viewer.ml index 852f67d243..ce789d733f 100644 --- a/compiler/syntax/src/res_parsetree_viewer.ml +++ b/compiler/syntax/src/res_parsetree_viewer.ml @@ -418,8 +418,9 @@ let should_inline_rhs_binary_expr rhs = true | _ -> false -(* Attributes on a module expression print before it and bind less tightly - than an application or a constraint *) +(* Attributes on a module expression bind less tightly than an application or + a constraint. Most module expressions print them before themselves, but an + await prints them after [await], and a functor on its first parameter. *) let mod_expr_has_attributes (mod_expr : Parsetree.module_expr) = mod_expr.pmod_attributes <> [] diff --git a/tests/ERROR_VARIANTS.md b/tests/ERROR_VARIANTS.md index e0e3e7e3ef..9c443b72b1 100644 --- a/tests/ERROR_VARIANTS.md +++ b/tests/ERROR_VARIANTS.md @@ -220,7 +220,6 @@ Source: `type error` in [typecore.ml](../compiler/ml/typecore.ml). | `Undefined_method` | ✓ | `super_errors_multi/Cross_module_alias_dot_access`, `undefined_method` | | | `Object_field_not_mutable` | ✓ | `object_write_closed_row`, `object_write_alias`, `object_write_after_forgetting`, `object_private_row_write`, `object_private_row_write_through_signature` | Assignment to a field without `@set`. `object_write_alias` pins that promotion is per equivalence class, and `object_write_after_forgetting` pins that a coercion never grants write capability. The private-row fixtures pin that a `Tconstr` row terminator is structurally open but cannot be strengthened: writing through `type t = private {.."x": int}` (directly or via a signature) is rejected, matching `unify_mutability`. | | `Private_type` | ✓ | `private_type_construction.res` | | -| `Private_label` | ✓ | `private_label.res` | | | `Not_subtype` | ✓ | `subtype_*.res`, `coercion_arity_mismatch.res`, `dict_show_no_coercion.res`, etc. | | | `Abstract_wrong_label` | ✓ | `abstract_wrong_label.res` | Multi-arg function literal where an inner argument label doesn't match the expected arrow's label (e.g. `let f: (~a, ~b) => int = (~a, ~c) => …`). | | `Scoping_let_module` | ✓ | `scoping_let_module.res` | | @@ -559,7 +558,9 @@ warnings still fire. Fixtures follow the naming convention `warning__.res` so coverage gaps stay greppable. Warning 11 (`Unused_match`) is covered by -`warning_11_equivalent_string_patterns.res`. +`warning_11_equivalent_string_patterns.res`, and warning 111 +(`Bs_private_record_mutation`, a write to a private record field) by +`private_label.res`. ### Removed warnings