see a pointer through a typedef of one

Only a written (* T) was a pointer, so with (typedef pt-ref (* pt)) a
path read q as a value and a method found no type to dispatch on.
This commit is contained in:
2026-10-17 17:35:47 +03:00
parent 4e97f52bb8
commit bf0cf33261
2 changed files with 21 additions and 4 deletions

View File

@@ -1454,11 +1454,12 @@
;;; `(* const char)' is flat: everything after the `*' is the target.
;;; `(& x)' builds the nested `(* (struct point))' and `unparse-type'
;;; writes the flat `(* struct point)', so both spellings turn up.
;;; (* T) -> T, and so for a typedef of one: (typedef pt-ref (* pt))
(define (pointer-target type)
(and (list? type)
(>= (length type) 2)
(eq? '* (car type))
(unwrap-type (cdr type))))
(cond ((and (list? type) (>= (length type) 2) (eq? '* (car type)))
(unwrap-type (cdr type)))
((and (symbol? type) (get-underlying-type type)) => pointer-target)
(else #f)))
;;; A path looks through a pointer wherever it meets one, the way the
;;; access itself does: `l.a->x' and `l.b.x' are both (. l a x) and