Skip to content

Commit

Permalink
XXX misc WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleidea committed May 5, 2024
1 parent 71ea10f commit ec647e9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lang/funcs/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func Register(name string, fn *types.FuncValue) {
if fn.T.Kind != types.KindFunc {
panic(fmt.Sprintf("simple func %s must be of kind func", name))
}
if fn.T.HasUni() {
panic(fmt.Sprintf("simple func %s contains a unification variable", name))
}
if fn.T.HasVariant() {
panic(fmt.Sprintf("simple func %s contains a variant type signature", name))
}
Expand Down
19 changes: 19 additions & 0 deletions lang/unification/fastsolver/fastsolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ package fastsolver

import (
"context"
"fmt"
"strings"

"github.com/purpleidea/mgmt/lang/unification"
Expand Down Expand Up @@ -125,5 +126,23 @@ func (obj *FastInvariantSolver) Solve(ctx context.Context, data *unification.Dat
}
}

// XXX: Just guessing about this next step... Somehow I feel something is wrong...
// XXX: I also need to check if I have any unification vars left...
// XXX: I also need to collect a list of what I _want_ to solve for and make sure I did...
for _, x := range data.UnificationInvariants { // []*UnificationInvariant
if x.Expect == nil || x.Actual == nil {
return nil, fmt.Errorf("WAT0")
}
t1 := unificationUtil.Extract(x.Expect)
t2 := unificationUtil.Extract(x.Actual)

if err := t1.Cmp(t2); err != nil { // XXX Should be the same... ???
return nil, errwrap.Wrapf(err, "WAT1")
}
if err := x.Expr.SetType(t1); err != nil {
return nil, errwrap.Wrapf(err, "WAT2")
}
}

panic("not implemented") // XXX RETURN SOMETHING
}

0 comments on commit ec647e9

Please sign in to comment.