print-str, print-i64, print-f64, print-bytes, print-line and newline leave the prelude. print and println are the whole printing surface now, and print is the better call at every one of the sites that used them: it is the same structural walk without the newline, so the no-newline case the family was kept for is covered, and it takes the value as it is. The old print-i64 forced an explicit (i64 x) at every call site, because this language widens nothing implicitly; that cast is gone from 127 places. Dropping it moves one answer. hash-grid returns u64, and the cast through the signed printer showed sand-headless's hash as -2851001042534928384. print routes a u64 through flan_u64_to_bytes, so it now prints 15595743031174623232 — the same 64 bits, read as the unsigned number they are. The pinned expectation follows the correction. test-flan-dev.el and test_session.ml both reached for print-line as "a name the prelude has"; they reach for rand-seed instead.
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
;;;; A package-qualified struct in return position.
|
|
;;;;
|
|
;;;; The parser decides "is this form a return type or the first body form?"
|
|
;;;; from the set of type names the file declares — and an import is resolved
|
|
;;;; after parsing, so a package's structs cannot be in that set. The result
|
|
;;;; was that (defn mk [] rl/Vector2 ...) read the return type as the body and
|
|
;;;; failed with "unknown name rl/Vector2", which named the symptom and not the
|
|
;;;; cause. The alias plus the capital is the signal: a bare capitalised symbol
|
|
;;;; is never a value here, since a constructor is (Name {...}) and an enum
|
|
;;;; member is a keyword.
|
|
(import edn "vendor:edn")
|
|
|
|
(defstruct Local [n i32])
|
|
|
|
;;; The case that used to fail: a package struct as the declared return type.
|
|
(defn fresh [src [u8]] edn/Cursor (edn/cursor src))
|
|
|
|
;;; And the one that must keep working: a lowercase qualified name in the same
|
|
;;; position is an expression, not a type.
|
|
(defn local [] Local (Local {:n 5}))
|
|
|
|
(defn main [] i32
|
|
(let [c (fresh (bytes "[1 2]"))
|
|
t (edn/next (addr c))]
|
|
(print (.kind t)) (println ""))
|
|
(print (.n (local))) (println "")
|
|
0)
|