Skip to content

Commit

Permalink
pat: fill patterns
Browse files Browse the repository at this point in the history
Co-authored-by: Hoshino Tented <[email protected]>
  • Loading branch information
ice1000 and HoshinoTented committed Jan 4, 2025
1 parent cbae523 commit 757f7a1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions base/src/main/java/org/aya/tyck/pat/ClauseTycker.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.aya.syntax.concrete.Pattern;
import org.aya.syntax.core.Jdg;
import org.aya.syntax.core.pat.Pat;
import org.aya.syntax.core.pat.PatToTerm;
import org.aya.syntax.core.pat.TypeEraser;
import org.aya.syntax.core.term.*;
import org.aya.syntax.ref.LocalCtx;
Expand Down Expand Up @@ -218,6 +219,14 @@ else if (result.hasError) {
exprTycker.solveMetas();
wellBody = zonker.zonk(wellBody);

// fill missing patterns and eta body
var unpiPat = result.unpiedResult.params().mapIndexed((idx, x) ->
// It would be nice if we have a SourcePos for the LocalVar
new Pat.Bind(new LocalVar("unpi" + idx), x.type()));

Check warning on line 225 in base/src/main/java/org/aya/tyck/pat/ClauseTycker.java

View check run for this annotation

Codecov / codecov/patch

base/src/main/java/org/aya/tyck/pat/ClauseTycker.java#L225

Added line #L225 was not covered by tests

var fullPats = result.clause.pats().view().concat(unpiPat);
wellBody = AppTerm.make(wellBody, unpiPat.view().map(PatToTerm::visit));

// bind all pat bindings
var patBindTele = Pat.collectVariables(result.clause.pats().view()).component1();
bindCount = patBindTele.size();
Expand Down

0 comments on commit 757f7a1

Please sign in to comment.