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

@@ -458,9 +458,15 @@ func TestAstFunc1(t *testing.T) {
xlogf := func(format string, v ...interface{}) {
logf("unification: "+format, v...)
}
solver, err := unification.LookupDefault()
if err != nil {
t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: solver lookup failed with: %+v", index, err)
return
}
unifier := &unification.Unifier{
AST: iast,
Solver: unification.SimpleInvariantSolverLogger(xlogf),
Solver: solver,
Debug: testing.Verbose(),
Logf: xlogf,
}
@@ -1028,9 +1034,15 @@ func TestAstFunc2(t *testing.T) {
xlogf := func(format string, v ...interface{}) {
logf("unification: "+format, v...)
}
solver, err := unification.LookupDefault()
if err != nil {
t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: solver lookup failed with: %+v", index, err)
return
}
unifier := &unification.Unifier{
AST: iast,
Solver: unification.SimpleInvariantSolverLogger(xlogf),
Solver: solver,
Debug: testing.Verbose(),
Logf: xlogf,
}
@@ -1830,9 +1842,15 @@ func TestAstFunc3(t *testing.T) {
xlogf := func(format string, v ...interface{}) {
logf("unification: "+format, v...)
}
solver, err := unification.LookupDefault()
if err != nil {
t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: solver lookup failed with: %+v", index, err)
return
}
unifier := &unification.Unifier{
AST: iast,
Solver: unification.SimpleInvariantSolverLogger(xlogf),
Solver: solver,
Debug: testing.Verbose(),
Logf: xlogf,
}