lang: Structurally refactor type unification

This will make it easier to add new solvers and also cleans up some
pending issues.
This commit is contained in:
James Shubin
2024-03-30 16:55:20 -04:00
parent 964bd8ba61
commit cede7e5ac0
10 changed files with 374 additions and 173 deletions

View File

@@ -269,13 +269,18 @@ func (obj *GAPI) Cli(info *gapi.Info) (*gapi.Deploy, error) {
}
}
logf("running type unification...")
startTime := time.Now()
solver, err := unification.LookupDefault()
if err != nil {
return nil, errwrap.Wrapf(err, "could not get default solver")
}
unifier := &unification.Unifier{
AST: iast,
Solver: unification.SimpleInvariantSolverLogger(unificationLogf),
Solver: solver,
Debug: debug,
Logf: unificationLogf,
}
startTime := time.Now()
unifyErr := unifier.Unify(context.TODO())
delta := time.Since(startTime)
formatted := delta.String()