From 58d1e352258b03fe9d91c6eb7d42024506904d04 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 25 Sep 2026 15:16:56 +0700 Subject: [PATCH] A local of a package's type is named by its qualified type in the break buffer's listing and the inspector, pinned by a shape/Box local in dev-inspect.flan --- TODO.org | 6 ------ test/programs/dev-inspect.flan | 7 +++++-- test/test_dev.ml | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/TODO.org b/TODO.org index 899c9b6e..306111cc 100644 --- a/TODO.org +++ b/TODO.org @@ -1693,12 +1693,6 @@ a defcustom. The agent keeps the condition pointer beside its name and a verb hands it back, so the editor can render the condition's own fields rather than only its class. -** NEXT The type identity of a local is not qualified -Decided 2026-09-25: a local's type prints package-qualified in the break buffer and the inspector, as a field's and a condition's already do. -Settled for conditions and for structs, because =Load= qualifies every declaration -at import. Still open for locals, where the debug information gives a bare name and -nothing qualifies it. - ** NEXT The render-thunk-per-inspection design Decided 2026-09-25: the inspector reads a value through the type layouts the compiler records, with no compile per inspection, which lets it hold a value. An inspection still compiles a thunk per request. A redesign rather than a diff --git a/test/programs/dev-inspect.flan b/test/programs/dev-inspect.flan index 81a65af3..85a30c54 100644 --- a/test/programs/dev-inspect.flan +++ b/test/programs/dev-inspect.flan @@ -11,8 +11,10 @@ ;;;; The other locals are the shapes a path step has to walk and that an ;;;; expression cannot reach at all: an option's payload, which has no ;;;; accessor form in the language, and a union case's field, whose offset -;;;; depends on which case the value is in. +;;;; depends on which case the value is in. And a local of a package's type, +;;;; which is named as the checker names it everywhere else: qualified. (import agent "vendor:agent") +(import shape "pkgs/shape") (defstruct Point [x f32 y f32]) (defstruct Boom [why i32]) @@ -38,7 +40,8 @@ (let [mark (Point {.x 1.5 .y 2.5}) xs [10 20 30] box (Some (Point {.x 4.5 .y 5.5})) - s (Shape.Rect {.w 3 .h 6})] + s (Shape.Rect {.w 3 .h 6}) + pk (shape/box 3 4)] (deeper))) (defonce ticks i64) diff --git a/test/test_dev.ml b/test/test_dev.ml index d5446668..7cf14617 100644 --- a/test/test_dev.ml +++ b/test/test_dev.ml @@ -2516,6 +2516,21 @@ let () = want "box" "(some)" "Point" "(Point {.x 4.5 .y 5.5})"; want "box" "(some \"x\")" "f32" "4.5"; want "s" "(\"Shape.Rect.w\")" "i32" "3"; + (* A package's type is its qualified name, in the inspector and in + the listing both, as a field's and a condition's already are: + two packages may each declare a Box. *) + want "pk" "()" "shape/Box" "(shape/Box {.w 3 .h 4})"; + (match Wire.field listing "locals" with + | Some { Form.v = Form.List l; _ } + when List.exists + (fun (e : Form.t) -> + match e.Form.v with + | Form.List + ({ Form.v = Form.Str "pk"; _ } + :: { Form.v = Form.Str "shape/Box"; _ } :: _) -> true + | _ -> false) + l -> () + | _ -> fail "the listing does not name pk's type as shape/Box"); (* Where each value is stored. The struct and its first field share an address and the second field is one f32 further on, so the number is the layout's and not a label. *)