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: generic associated types with quantified bindings (issue #234)

ADR 0047, fourth part. Associated types with their own parameters
already reduced since the first part (`Mapped<c, x>`, the trait's
arguments then its own). This adds their bindings, which quantify those
parameters: `where Mappable<c, Mapped<y> = List<y>>` says that mapping
`c` gives a list whatever `y` is.

- **`Equality`** (`lhs`, `rhs`, `binders`) replaces the `(Ty, Ty)` pairs
  of schemes, arms, givens and leftovers. Binders are the variables a
  binding quantifies, as they stand in it.
- **Lowering:**
  - a binding's parameters are in scope for that binding only: scheme
    variables in a signature, rigids in its body, inference variables
    elsewhere;
  - a parameter may not reuse a name of the signature (E0416), so a
    printed signature reads back the same.
- **At a call:** each binder is a fresh *scoped* rigid, named as the
  binding names it, so the call must satisfy the binding for every type.
  The escape check keeps such a rigid from being captured outside.
- **In a body,** or in a matched constructor's arm, a quantified given
  matches a projection's own arguments one way, like a rewrite rule.
- **Determinedness:** binders need no determining.
- **Printing:** `Mappable<c, Mapped<y> = List<y>>`.

Own parameters are types, and a projection is always fully applied, so
`Functor<Mapped<c>>` is a kind error.

Tests:
- `tests/run/gats.lse` on both backends: two impls, and bodies relying on
  quantified bindings.
- `tests/ui/assoc_types.lse`: the printed scheme; a call whose impl breaks
  the binding (`expected Mapped<Duo, y>, found List<y>`); a binder named
  like a signature variable.

The generated C of every existing program is byte-identical.

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

olivier · il y a 1 mois · 2f2b2456f269962eae77a6563fa259ea64f23aaf

Parents a7a312e

10 fichiers modifiés, 239 ajouts, 47 suppressions