.ty, type parameters, T::kind, match on a kindOpen and answer this issue on GitHub.
language, ready · opened 2026-10-26 · updated 2026-10-31 · 2 comments
ADR-329 (.ty, .doc) and ADR-330 (a type passed as a parameter, T::kind, meta::Type) are Accepted, but none of it is built. Found while building json (#604): field.ty is NK1180, a type in a parameter list is a parse error, T::kind with Struct/List/Maybe arms exists nowhere. The only NK1230 case in the compiler is the one from #704 (check_core_expr.nika), not ADR-330 D1’s mechanism. json::write[T], the schema input and read[T] (#604) need these.
ADR-329, ADR-330, Part II 10.3. Nothing new is decided here; this issue only tracks the build. Whether the ADRs cover everything #604 needs is decided in a later round.
Not specified, so not in this list: building a value of a struct from reflected fields (needed by json::read[T], today field.set is NK1180). That is a separate open decision.
Each step with its tests as .nika in tests/compiler/.
.ty on a reflected field: the field’s type itself (ADR-329 D1, ADR-330 D5), field.ty::kind.schema(CreateUser) (ADR-330 D1); a type where a value belongs is NK1230.T::kind, T::name, T::doc, T::access and meta::Type (Text, List(A), Maybe(A), Map(K,V), Struct(T), Enum(T), Opaque(T), Fn(F)) (ADR-330 D2, D3, D8).match on a kind: each arm is checked under its kind (ADR-330 D4).meta::Type only at build time, NK1231 otherwise (ADR-330 D6)..doc on fields and types (ADR-329 D2).Named removed from meta::Type, recursion by the type itself (ADR-330 D7).f[T]() allowed with warning NK1233 (ADR-330 D9; use cases are collected in #514).The commit that builds the last step says Fixes #N.
Status, 0.0.1317:
T::kind is a meta::Type, plus T::name. A kind can be compared with ==/!= if it carries no type. NK1231 stops one that would reach run time.T::fields, field.ty is the field’s type, so field.ty::name, field.ty::kind and field.ty::fields all work. expr.name::member now parses.match T::kind { Text => …, List(it) => …, Struct(s) => … }, every arm is checked under its own kind, and each type emits only the arm it takes.Still open: step 2 (a type as an argument, schema(User)), step 8 (parsing f[T]() and narrowing NK1233, ADR-grammar-2 D11), and steps 5–7. #1019 waits on steps 2 and 8.
The build found a lowering defect: #1044.
Generated by Claude Code
Status, 0.0.1319:
fn schema[T](T) with schema(User). The type can come from a named type, a type parameter, field.ty or a match-arm binding, and recursion works. A value in the type’s place, or a type where a value belongs, is NK1230.pick[User](1) fills the type parameters in order. warning[NK1233] (naming #514) is raised only when a value argument already says the type, e.g. id[i64](3). A method’s x.f[T]() is still refused. NK1233 was not built at all before this.Gaps the build found:
std, such as json::read[Contact](bytes), still treats Contact as a value and gives NK1230. ADR-grammar-2 D11 specifies this form, so it is a defect, and #1019 needs it fixed.parse[Config](text) is shown as “still warned”, but under D11’s rule no value argument says T, so it would not be warned. Owner decision pending.Still open: steps 5–7.
Generated by Claude Code