Skip to content

feat!(ltk_ritobin): AST - #185

Open
alanpq wants to merge 57 commits into
mainfrom
ritobin/ast
Open

feat!(ltk_ritobin): AST#185
alanpq wants to merge 57 commits into
mainfrom
ritobin/ast

Conversation

@alanpq

@alanpq alanpq commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Completely replaces old typecheck module with an AST that resolves values as it constructs

This definitely will have to be squashed

@alanpq
alanpq requested a review from Crauzer August 23, 2026 22:50
@Crauzer Crauzer added crate:ltk_ritobin Ritobin text format crate area:api Public API design priority:high High priority labels Aug 23, 2026
Comment thread crates/ltk_ritobin/src/ast/resolve/literals.rs Outdated
Comment thread crates/ltk_ritobin/src/ast/query/nodes.rs Outdated
Comment thread crates/ltk_ritobin/src/cst/tree.rs Outdated
Comment thread crates/ltk_ritobin/src/ast/resolve/block_value.rs Outdated
Comment thread crates/ltk_ritobin/src/ast/resolve/entry.rs Outdated
Comment thread crates/ltk_ritobin/src/ast/node/value/coerce.rs
#[inline(always)]
#[must_use]
/// Whether the value is container-like - (unordered) container, map, optional
pub fn is_containerlike(&self) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant: #204 (comment)

@Crauzer
Crauzer force-pushed the ritobin/ast branch 3 times, most recently from 0a0abc5 to eca40b8 Compare August 30, 2026 10:02
alanpq and others added 27 commits August 30, 2026 12:25
We report an error which is enough to flag the bin as invalid, and
preserving the type as is lets us do comparisons later
removing the double error needs parser changes
type expressions in the Property node now Spanned<Option<TypeExpr>>,
which means you can now distinguish between a missing expression & a
broken/unresolved one, and they always have a span (points to where the
expression *should* be if missing)
Ported from feat/ptch-resolve (#187), where the declaration-time type-param
checks were first written; this branch's resolver already rejects container
subtypes (InvalidNesting), so the missing half was the map key rule:
map[link,u32] and friends now report InvalidMapKey on the declaration.

The link row leaves map_keys_of_every_key_type_keep_their_pair to match:
no shipped bin keys a map on a link, and ltk_meta's map constructors on
main reject it (Kind::is_valid_map_key) once this branch rebases past #187.

A link map key is not just unused, the client cannot express one. When the
map reader synthesizes the descriptors for its nested key/value reads, only
the value slot inherits the property's target class; the key's descriptor
gets a null one. A link needs that target class to resolve, so a link key
has nothing to resolve against - impossible by construction, not convention.
Map::empty and Optional::empty return Result since ltk_meta validates map
kinds at construction; route both through to_bin's assert-with-fallback,
the same way Container::empty already goes.
The declaration check was written against is_primitive because this branch
predated the predicate; ltk_meta deliberately keeps key validity (a map
format question) separate from primitiveness (a value model question), so
ask the right one now that the rebase brought it in. Same set today.
@Crauzer

Crauzer commented Aug 30, 2026

Copy link
Copy Markdown
Member

👉👈

@notwinterdust

Copy link
Copy Markdown

👉👈

do you sleep enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:api Public API design crate:ltk_ritobin Ritobin text format crate priority:high High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants