lang: unification: Add partial func knowledge to solved
This performs the same task as the previous two commits, but it also adds partial information when solving a func.
This commit is contained in:
@@ -621,6 +621,16 @@ Loop:
|
|||||||
t, exists := funcPartials[eq.Expr1][y]
|
t, exists := funcPartials[eq.Expr1][y]
|
||||||
if !exists {
|
if !exists {
|
||||||
funcPartials[eq.Expr1][y] = typ // learn!
|
funcPartials[eq.Expr1][y] = typ // learn!
|
||||||
|
|
||||||
|
// Even though this is only a partial learn, we should still add it to the solved information!
|
||||||
|
if newTyp, exists := solved[y]; !exists {
|
||||||
|
solved[y] = typ // yay, we learned something!
|
||||||
|
//used = append(used, i) // mark equality as used up when complete!
|
||||||
|
logf("%s: solved partial func arg equality", Name)
|
||||||
|
} else if err := newTyp.Cmp(typ); err != nil {
|
||||||
|
return nil, errwrap.Wrapf(err, "can't unify, invariant illogicality with partial func arg equality")
|
||||||
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := t.Cmp(typ); err != nil {
|
if err := t.Cmp(typ); err != nil {
|
||||||
@@ -635,6 +645,16 @@ Loop:
|
|||||||
t, exists := funcPartials[eq.Expr1][y]
|
t, exists := funcPartials[eq.Expr1][y]
|
||||||
if !exists {
|
if !exists {
|
||||||
funcPartials[eq.Expr1][y] = typ // learn!
|
funcPartials[eq.Expr1][y] = typ // learn!
|
||||||
|
|
||||||
|
// Even though this is only a partial learn, we should still add it to the solved information!
|
||||||
|
if newTyp, exists := solved[y]; !exists {
|
||||||
|
solved[y] = typ // yay, we learned something!
|
||||||
|
//used = append(used, i) // mark equality as used up when complete!
|
||||||
|
logf("%s: solved partial func return equality", Name)
|
||||||
|
} else if err := newTyp.Cmp(typ); err != nil {
|
||||||
|
return nil, errwrap.Wrapf(err, "can't unify, invariant illogicality with partial func return equality")
|
||||||
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := t.Cmp(typ); err != nil {
|
if err := t.Cmp(typ); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user