tobogganSe connecter

louise

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

Types: one map of what an arm refines, kept acyclic — fixes a stack overflow (issue #224)

Trait resolution (`traits::Local`) and the exhaustiveness checker
(`exhaust::Eqs`) kept the equalities a refined constructor gives in two
maps, each with its own substitution. They share `refine::Refinements`
now, which refuses an equality whose type mentions its variable.

The checker had no such check, and it crashed the compiler: with
`Cycle(Int) -> Cyclic<a, List<a>, a>`, a `Cyclic<x, x, x>` made `x` be
`List<x>`, and comparing two types then recursed until the stack
overflowed. A parameter of that type was enough (the check that its
pattern is irrefutable), so `louise check` died on a function that only
takes one. A refused equality now makes the constructor impossible there,
as inference already said (E0202).

Inference's `match_index` and the checker's `index_match` stay separate
walks: inference decides what an arm may assume (it unifies, introduces
hidden types, undoes it after the arm), the checker only asks whether a
constructor is possible. Each is documented with why; ADR 0041 gets a
note (Proposed), and merging them is left to the engineering review.

Tests: unit tests of the refusal; UI tests of the cycle (a parameter,
and a match), and of one refinement read by inference, trait resolution
and exhaustiveness together.

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

olivier · il y a 1 mois · 1b99666db00e2edd09493de445e324a82942eed4

Parents e02d8a5

7 fichiers modifiés, 200 ajouts, 36 suppressions