lang: funcs: Fix one small typo and one small logic bug
I don't think the logic bug had any negative effect, but let's be safe.
This commit is contained in:
@@ -153,6 +153,9 @@ func (obj *ListLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant,
|
|||||||
return nil, fmt.Errorf("unable to build function with %d args", l)
|
return nil, fmt.Errorf("unable to build function with %d args", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var invariants []interfaces.Invariant
|
||||||
|
var invar interfaces.Invariant
|
||||||
|
|
||||||
// add the relationship to the returned value
|
// add the relationship to the returned value
|
||||||
invar = &interfaces.EqualityInvariant{
|
invar = &interfaces.EqualityInvariant{
|
||||||
Expr1: cfavInvar.Expr,
|
Expr1: cfavInvar.Expr,
|
||||||
@@ -179,9 +182,6 @@ func (obj *ListLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant,
|
|||||||
}
|
}
|
||||||
invariants = append(invariants, invar)
|
invariants = append(invariants, invar)
|
||||||
|
|
||||||
var invariants []interfaces.Invariant
|
|
||||||
var invar interfaces.Invariant
|
|
||||||
|
|
||||||
// If we figure out either of these types, we'll know
|
// If we figure out either of these types, we'll know
|
||||||
// the full type...
|
// the full type...
|
||||||
var t1 *types.Type // list type
|
var t1 *types.Type // list type
|
||||||
@@ -316,7 +316,7 @@ func (obj *ListLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant,
|
|||||||
|
|
||||||
// XXX: if t{1..2} are missing, we could also return a
|
// XXX: if t{1..2} are missing, we could also return a
|
||||||
// new generator for later if we learn new information,
|
// new generator for later if we learn new information,
|
||||||
// but we'd have to be careful to not do the infinitely
|
// but we'd have to be careful to not do it infinitely.
|
||||||
|
|
||||||
// TODO: do we return this relationship with ExprCall?
|
// TODO: do we return this relationship with ExprCall?
|
||||||
invar = &interfaces.EqualityWrapCallInvariant{
|
invar = &interfaces.EqualityWrapCallInvariant{
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ func (obj *MapLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant, e
|
|||||||
return nil, fmt.Errorf("unable to build function with %d args", l)
|
return nil, fmt.Errorf("unable to build function with %d args", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var invariants []interfaces.Invariant
|
||||||
|
var invar interfaces.Invariant
|
||||||
|
|
||||||
// add the relationship to the returned value
|
// add the relationship to the returned value
|
||||||
invar = &interfaces.EqualityInvariant{
|
invar = &interfaces.EqualityInvariant{
|
||||||
Expr1: cfavInvar.Expr,
|
Expr1: cfavInvar.Expr,
|
||||||
@@ -171,9 +174,6 @@ func (obj *MapLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant, e
|
|||||||
}
|
}
|
||||||
invariants = append(invariants, invar)
|
invariants = append(invariants, invar)
|
||||||
|
|
||||||
var invariants []interfaces.Invariant
|
|
||||||
var invar interfaces.Invariant
|
|
||||||
|
|
||||||
// If we figure out all of these three types, we'll
|
// If we figure out all of these three types, we'll
|
||||||
// know the full type...
|
// know the full type...
|
||||||
var t1 *types.Type // map type
|
var t1 *types.Type // map type
|
||||||
@@ -342,7 +342,7 @@ func (obj *MapLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant, e
|
|||||||
|
|
||||||
// XXX: if t{1..3} are missing, we could also return a
|
// XXX: if t{1..3} are missing, we could also return a
|
||||||
// new generator for later if we learn new information,
|
// new generator for later if we learn new information,
|
||||||
// but we'd have to be careful to not do the infinitely
|
// but we'd have to be careful to not do it infinitely.
|
||||||
|
|
||||||
// TODO: do we return this relationship with ExprCall?
|
// TODO: do we return this relationship with ExprCall?
|
||||||
invar = &interfaces.EqualityWrapCallInvariant{
|
invar = &interfaces.EqualityWrapCallInvariant{
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ func (obj *StructLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant
|
|||||||
return nil, fmt.Errorf("unable to build function with %d args", l)
|
return nil, fmt.Errorf("unable to build function with %d args", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var invariants []interfaces.Invariant
|
||||||
|
var invar interfaces.Invariant
|
||||||
|
|
||||||
// add the relationship to the returned value
|
// add the relationship to the returned value
|
||||||
invar = &interfaces.EqualityInvariant{
|
invar = &interfaces.EqualityInvariant{
|
||||||
Expr1: cfavInvar.Expr,
|
Expr1: cfavInvar.Expr,
|
||||||
@@ -163,9 +166,6 @@ func (obj *StructLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant
|
|||||||
}
|
}
|
||||||
invariants = append(invariants, invar)
|
invariants = append(invariants, invar)
|
||||||
|
|
||||||
var invariants []interfaces.Invariant
|
|
||||||
var invar interfaces.Invariant
|
|
||||||
|
|
||||||
// second arg must be a string
|
// second arg must be a string
|
||||||
invar = &interfaces.EqualsInvariant{
|
invar = &interfaces.EqualsInvariant{
|
||||||
Expr: cfavInvar.Args[1],
|
Expr: cfavInvar.Args[1],
|
||||||
@@ -282,7 +282,7 @@ func (obj *StructLookupFunc) Unify(expr interfaces.Expr) ([]interfaces.Invariant
|
|||||||
|
|
||||||
// XXX: if t1 or t2 are missing, we could also return a
|
// XXX: if t1 or t2 are missing, we could also return a
|
||||||
// new generator for later if we learn new information,
|
// new generator for later if we learn new information,
|
||||||
// but we'd have to be careful to not do the infinitely
|
// but we'd have to be careful to not do it infinitely.
|
||||||
|
|
||||||
// TODO: do we return this relationship with ExprCall?
|
// TODO: do we return this relationship with ExprCall?
|
||||||
invar = &interfaces.EqualityWrapCallInvariant{
|
invar = &interfaces.EqualityWrapCallInvariant{
|
||||||
|
|||||||
Reference in New Issue
Block a user