1
0
forked from alex-eg/sex

name what a member path could not type

Past a typed base, it is a field of a struct only C knows that has no
type, and the warning named the base anyway: `font' for what was
(. font handle), with font declared on the line before.

Fixes #41.
This commit is contained in:
2026-10-09 17:28:20 +03:00
parent a5520bf4b9
commit b019da3fb3
2 changed files with 16 additions and 2 deletions

View File

@@ -833,6 +833,14 @@ whitespace aside, THEN?"
(emits? (in-line "(= (. (guess) x) 1)") "guess().x = 1"))
(test-assert "and said so"
(warns? (in-line "(= (. (guess) x) 1)") "cannot type this"))
;; Past a typed base it is a field that cannot be typed -- one of a
;; struct only C knows -- and the warning named the base regardless
(test-assert "naming the path read so far"
(warns? (in-fn "(var t (* struct tm) 0) (= (. t a b) 1)")
"as a value (. t a)\n"))
(test-assert "which one step through it does not need"
(not (warns? (in-fn "(var t (* struct tm) 0) (= (. t a) 1)")
"cannot type")))
;; the arrow is `%->' and nothing else writes one, so a bare `->'
;; is an ordinary head -- a threading macro that nobody imported,
;; and a call like any other unknown