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: a rigid row tail under a nonempty row; packages: `pg.savepoint` (ADR 0010 note)

A `use` callback (a lambda) could not call its action after a concrete
effect: E0502, because a call whose row's tail is a rigid row variable
was only allowed when the current row was still empty. Now the current
row's flexible tail becomes the callee's extra labels over the rigid one
(`perform` in `louise_types::infer::effects`), so

    use _ <- result.try(execute("savepoint " <> name, []))
    match action() { ... }

checks. One restriction stays, documented in ADR 0010's note: after such
a call, a *new* concrete effect in the same scope can't extend the
now-rigid tail (perform it first). Two repairs ride along:

- the dead-row lint (issue #203) read each call's unzonked labels, so an
  effect performed only through a callback's row variable looked dead;
  it reads the zonked row now;
- a site reported by `resolve` (a handler a callback's fixed type can't
  use) was reported again by `unhandled`: one E0502 per site.

tests/ui/effects.lse pins both the accepted shape and the remaining
restriction. With it, the postgres package's `savepoint` is the clean
form, and `with_connection` keeps its `use` (transactions keep the
`match` on purpose: the begin-failure path releases the connection).

`pg.savepoint(fn() { ... })`: SAVEPOINT/RELEASE on the transaction's
connection, `ROLLBACK TO SAVEPOINT` on an `Error` — nested transactions
for #145. Names are generated. Live-tested against postgres:18: a failing
savepoint keeps the outer transaction's writes.

olivier · il y a 1 mois · b13b3778ae6cac45b7c7f32a1daae68466ce156f

Parents ef4bfca

6 fichiers modifiés, 167 ajouts, 28 suppressions

Mcrates/louise_types/src/infer/effects.rs+31−7
Mdocs/adr/0010-lexical-handlers.md+16−0
Mpackages/postgres/test/pool_test.lse+52−4