lang: ast: Ensure a list doesn't sneak through type interpolation
If we had a single list wrapped in an interpolated string, it could sneak through type unification, which is not correct. Wrapping a variable by interpolation in a string, must force it to be a string.
This commit is contained in:
@@ -5408,6 +5408,10 @@ func (obj *ExprStr) Interpolate() (interfaces.Expr, error) {
|
||||
}, nil
|
||||
}
|
||||
// we got something, overwrite the existing static str
|
||||
// ensure str, to avoid a pass-through list in a simple interpolation
|
||||
if err := result.SetType(types.TypeStr); err != nil {
|
||||
return nil, errwrap.Wrapf(err, "interpolated string expected a different type")
|
||||
}
|
||||
return result, nil // replacement
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user