Files
AILang/examples/ct_2_bare_cross_module.ailx
T

32 lines
1.1 KiB
Plaintext

; Fieldtest — canonical-type-names, axis 1: BareCrossModuleTypeRef.
;
; A consumer of std_maybe deliberately writes a BARE `Maybe` in its
; fn signature instead of `std_maybe.Maybe`. Per ct.1's load-time
; validator, the canonical form requires cross-module type refs to
; be qualified. Expected: workspace-load error
; `BareCrossModuleTypeRef` naming the type and listing the qualified
; form as a candidate.
;
; This is what an LLM author would write if they forgot the
; cross-module-qualification rule — the rule fires here at load
; time, not deep inside the typechecker.
(module ct_2_bare_cross_module
(import std_maybe)
(fn classify
(doc "Identity over Maybe<Int>; signature uses bare `Maybe` instead of `std_maybe.Maybe`.")
(type
(fn-type
(params (con Maybe (con Int)))
(ret (con Maybe (con Int)))))
(params m)
(body m))
(fn main
(type (fn-type (params) (ret (con Unit)) (effects IO)))
(params)
(body
(do io/print_int (app std_maybe.from_maybe 99 (app classify (term-ctor std_maybe.Maybe Just 7)))))))