You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Four review findings on #8597, all confirmed by probe or inspection:
Variance ignored field mutability. The old phantom "x#=" setter member
was an arrow whose contravariant occurrence incidentally made settable
fields invariant; removing the phantom left compute_variance treating
every field payload with the ambient variance, so an explicitly covariant
parameter could annotate a settable field and leak write capability
through an abstract type. The Tfield arm now sends a Mutable field's
payload through Variance.full, like a mutable record label; Immutable
fields keep the ambient variance, preserving read-only covariance.
Pinned by object_settable_field_covariant_param (Bad_variance).
Writes instantiated polymorphic field schemes. Assigning to
{@set "id": 'a. 'a => 'a} typed the value at one instance, so a
monomorphic function satisfied the field while reads kept instantiating
the unchanged scheme. A field's type is a scheme: reading eliminates it,
writing must establish it. The write path now uses the checker's
scheme-introduction discipline - fixed instantiation, typing at that
instance, check_univars - extracted as type_object_field_value next to
its record twin type_label_exp, returning the value at an ordinary
instance as both siblings do. type_label_exp's PR#4862 retry is a
label-specific completeness recovery and is deliberately not replicated;
the helper's comment records that. Pinned by
object_write_poly_field_less_general (Less_general) and a positive
settable-poly case in object_poly_field.
Along the way, instance_poly's positional boolean becomes ~fixed with a
contract comment in ctype.mli: the flag controls fixed copying of
polymorphic-variant rows; scheme introduction is identified by the whole
operation, not by this flag.
reanalyze missed Texp_object_literal. Side-effect analysis fell through
to the permissive default, so a dead binding whose object literal called
effectful code was classified as removable; it now checks every field
expression (ObjectLiteralSideEffects deadcode case). Termination
analysis crashed on the wildcard; it now compiles the literal as an
ordered sequence of its fields - ordered, not unordered, because fields
evaluate in source order and crediting a later field's progress past a
non-returning earlier field would be unsound (the
testObjectLiteralRecursionFirst case is now reported as a possible
infinite loop while testObjectLiteralProgressFirst passes).
Texp_object_get/Texp_object_set traverse their receiver and value
instead of asserting (testObjectAccess).
Signed-Off-By: Cristiano Calcagno <ccrisccris@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PCtQiaDijUqA2fujQXvKUw
|`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) => …`). |
|`Less_general`| ✓ |`less_general_universal.res`, `object_write_poly_field_less_general.res`| The latter pins that assigning to a polymorphic object field checks the value against the field's scheme.|
|`Rebind_wrong_type`| ✓ |`extension_rebind_mismatch.res`| Rebinding constructor into a different extensible type fails while unifying the source constructor result with the extension target. |
279
279
|`Rebind_mismatch`| ? | — | The later declaration-shape check after `Rebind_wrong_type`; no source fixture was confirmed in this pass. |
280
280
|`Rebind_private`| ✓ |`extension_rebind_private.res`| Rebinding a private extension constructor as public. |
|`Bad_variance`| ✓ |`bad_variance.res`, `bad_variance_contra.res`, `object_settable_field_covariant_param.res`| The latter pins that a settable object field is an invariant occurrence, like a mutable record label.|
282
282
|`Unavailable_type_constructor`| ☐ (needs build harness) | — | typedecl.ml:778. Requires a type path findable at parse time but missing during constraint enforcement; only cross-unit scenarios where a `.cmi` was found but later removed. |
283
283
|`Bad_fixed_type`| ✓ |`fixed_type_no_row_variable.res`| Fully-bounded closed private polymorphic variant (`type t = private [< #A | #B > #A #B]`) satisfies `is_fixed_type` but has a static (non-`Tvar`) row. |
Dead Value +ObjectLiteralSideEffects.+deadWithEffect
3642
+
Dead Value +ObjectLiteralSideEffects.+deadNoEffect
3638
3643
Live (annotated) Value +OcamlWarningSuppressToplevel.+suppressed1
3639
3644
Live (annotated) Value +OcamlWarningSuppressToplevel.+suppressed2
3640
3645
Live (annotated) Value +OcamlWarningSuppressToplevel.M.+suppressed3
@@ -5251,6 +5256,18 @@ Forward Liveness Analysis
5251
5256
Newsyntax.res:12:24-29
5252
5257
record2.yy is a record label never used to read a value
5253
5258
5259
+
Warning Dead Module
5260
+
ObjectLiteralSideEffects.res:0:1
5261
+
ObjectLiteralSideEffects is a dead module as all its items are dead.
5262
+
5263
+
Warning Dead Value With Side Effects
5264
+
ObjectLiteralSideEffects.res:3:1-49
5265
+
deadWithEffect is never used and could have side effects
5266
+
5267
+
Warning Dead Value
5268
+
ObjectLiteralSideEffects.res:4:1-27
5269
+
deadNoEffect is never used
5270
+
5254
5271
Warning Dead Type
5255
5272
Opaque.res:2:26-41
5256
5273
opaqueFromRecords.A is a variant case which is never constructed
@@ -5643,4 +5660,4 @@ Forward Liveness Analysis
5643
5660
OptArg.res:14:1-42
5644
5661
optional argument b of function twoArgs is never used
5645
5662
5646
-
Analysis reported 327 issues (Incorrect Dead Annotation:1, Warning Dead Exception:2, Warning Dead Module:22, Warning Dead Type:94, Warning Dead Value:178, Warning Dead Value With Side Effects:5, Warning Redundant Optional Argument:7, Warning Unused Argument:18)
5663
+
Analysis reported 330 issues (Incorrect Dead Annotation:1, Warning Dead Exception:2, Warning Dead Module:23, Warning Dead Type:94, Warning Dead Value:179, Warning Dead Value With Side Effects:6, Warning Redundant Optional Argument:7, Warning Unused Argument:18)
0 commit comments