tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Lists: a spread keeps its place in a list literal (#448)

`[..xs, 3]` was `[3, 1, 2]`: the AST exposed a list literal's items and
only its first spread, and HIR kept `{ elems, tail }`, so a spread that
was not last moved to the end and any later spread was dropped, with no
diagnostic, on both backends.

The AST now yields items and spreads in source order (`ListElement`),
HIR keeps them in order (`Expr::List(Vec<ListElem>)`), and Core lowers
every part first, left to right, then builds the list from its end: a
last spread is the tail as is, an item is consed on, any other spread
goes through `list$append`, a Core helper made once per program (TRMC
keeps it in constant stack). Literals with no spread or only a last one
lower to the same Core as before (scripts/same-output.sh: no difference
outside the new test). Inference checks the items, then the spreads, so
a bad spread reports `List<Int>` rather than a type variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 6 j · 0ed2e0eab2450089b88251e7d99757eafffbb471

Parents 67b2420

11 fichiers modifiés, 277 ajouts, 56 suppressions