aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
454 stars 84 forks source link

backpassing multiple patterns #874

Closed rvcas closed 5 months ago

rvcas commented 6 months ago

The main trick here was transforming Assignment to contain Vec<UntypedPattern, Option<Annotation>> in a field called patterns. This then meant that I could remove the pattern and annotation field from Assignment. The parser handles = and <- just fine because in the future = with multi patterns will mean some kind of optimization on tuples. But, since we don't have that optimization yet, when someone uses multi patterns with an = there will be an error returned from the type checker right where infer_seq looks for backpassing. From there the rest of the work was in Project::backpassing where I only needed to rework some things to work with a list of patterns instead of just one.

This is what the new error looks like CleanShot 2024-03-11 at 19 02 07@2x

This is what is looks like formatted with many args CleanShot 2024-03-11 at 18 59 26@2x