mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #10886 from hashicorp/b-update-hil
vendor: update HIL
This commit is contained in:
commit
077bd1fb67
36
vendor/github.com/hashicorp/hil/check_types.go
generated
vendored
36
vendor/github.com/hashicorp/hil/check_types.go
generated
vendored
@ -119,7 +119,9 @@ func (tc *typeCheckArithmetic) TypeCheck(v *TypeCheck) (ast.Node, error) {
|
|||||||
switch tc.n.Op {
|
switch tc.n.Op {
|
||||||
case ast.ArithmeticOpLogicalAnd, ast.ArithmeticOpLogicalOr:
|
case ast.ArithmeticOpLogicalAnd, ast.ArithmeticOpLogicalOr:
|
||||||
return tc.checkLogical(v, exprs)
|
return tc.checkLogical(v, exprs)
|
||||||
case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual, ast.ArithmeticOpLessThan, ast.ArithmeticOpGreaterThan, ast.ArithmeticOpGreaterThanOrEqual, ast.ArithmeticOpLessThanOrEqual:
|
case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual,
|
||||||
|
ast.ArithmeticOpLessThan, ast.ArithmeticOpGreaterThan,
|
||||||
|
ast.ArithmeticOpGreaterThanOrEqual, ast.ArithmeticOpLessThanOrEqual:
|
||||||
return tc.checkComparison(v, exprs)
|
return tc.checkComparison(v, exprs)
|
||||||
default:
|
default:
|
||||||
return tc.checkNumeric(v, exprs)
|
return tc.checkNumeric(v, exprs)
|
||||||
@ -135,20 +137,11 @@ func (tc *typeCheckArithmetic) checkNumeric(v *TypeCheck, exprs []ast.Type) (ast
|
|||||||
mathFunc := "__builtin_IntMath"
|
mathFunc := "__builtin_IntMath"
|
||||||
mathType := ast.TypeInt
|
mathType := ast.TypeInt
|
||||||
for _, v := range exprs {
|
for _, v := range exprs {
|
||||||
exit := true
|
// We assume int math but if we find ANY float, the entire
|
||||||
switch v {
|
// expression turns into floating point math.
|
||||||
case ast.TypeInt:
|
if v == ast.TypeFloat {
|
||||||
mathFunc = "__builtin_IntMath"
|
|
||||||
mathType = v
|
|
||||||
case ast.TypeFloat:
|
|
||||||
mathFunc = "__builtin_FloatMath"
|
mathFunc = "__builtin_FloatMath"
|
||||||
mathType = v
|
mathType = v
|
||||||
default:
|
|
||||||
exit = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// We found the type, so leave
|
|
||||||
if exit {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +186,6 @@ func (tc *typeCheckArithmetic) checkNumeric(v *TypeCheck, exprs []ast.Type) (ast
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (tc *typeCheckArithmetic) checkComparison(v *TypeCheck, exprs []ast.Type) (ast.Node, error) {
|
func (tc *typeCheckArithmetic) checkComparison(v *TypeCheck, exprs []ast.Type) (ast.Node, error) {
|
||||||
|
|
||||||
if len(exprs) != 2 {
|
if len(exprs) != 2 {
|
||||||
// This should never happen, because the parser never produces
|
// This should never happen, because the parser never produces
|
||||||
// nodes that violate this.
|
// nodes that violate this.
|
||||||
@ -220,6 +212,22 @@ func (tc *typeCheckArithmetic) checkComparison(v *TypeCheck, exprs []ast.Type) (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For non-equality comparisons, we will do implicit conversions to
|
||||||
|
// integer types if possible. In this case, we need to go through and
|
||||||
|
// determine the type of comparison we're doing to enable the implicit
|
||||||
|
// conversion.
|
||||||
|
if tc.n.Op != ast.ArithmeticOpEqual && tc.n.Op != ast.ArithmeticOpNotEqual {
|
||||||
|
compareFunc = "__builtin_IntCompare"
|
||||||
|
compareType = ast.TypeInt
|
||||||
|
for _, expr := range exprs {
|
||||||
|
if expr == ast.TypeFloat {
|
||||||
|
compareFunc = "__builtin_FloatCompare"
|
||||||
|
compareType = ast.TypeFloat
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Verify (and possibly, convert) the args
|
// Verify (and possibly, convert) the args
|
||||||
for i, arg := range exprs {
|
for i, arg := range exprs {
|
||||||
if arg != compareType {
|
if arg != compareType {
|
||||||
|
18
vendor/vendor.json
vendored
18
vendor/vendor.json
vendored
@ -1613,28 +1613,28 @@
|
|||||||
"revisionTime": "2016-11-30T20:58:18Z"
|
"revisionTime": "2016-11-30T20:58:18Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "xONRNgLDc5OqCUmyDN3iBRKmKB0=",
|
"checksumSHA1": "2Nrl/YKrmowkRgCDLhA6UTFgYEY=",
|
||||||
"path": "github.com/hashicorp/hil",
|
"path": "github.com/hashicorp/hil",
|
||||||
"revision": "60db937199ba6f67251aa038cec18ce36a951312",
|
"revision": "5b8d13c8c5c2753e109fab25392a1dbfa2db93d2",
|
||||||
"revisionTime": "2016-12-09T17:20:46Z"
|
"revisionTime": "2016-12-21T19:20:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "oZ2a2x9qyHqvqJdv/Du3LGeaFdA=",
|
"checksumSHA1": "oZ2a2x9qyHqvqJdv/Du3LGeaFdA=",
|
||||||
"path": "github.com/hashicorp/hil/ast",
|
"path": "github.com/hashicorp/hil/ast",
|
||||||
"revision": "60db937199ba6f67251aa038cec18ce36a951312",
|
"revision": "5b8d13c8c5c2753e109fab25392a1dbfa2db93d2",
|
||||||
"revisionTime": "2016-12-09T17:20:46Z"
|
"revisionTime": "2016-12-21T19:20:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "P5PZ3k7SmqWmxgJ8Q0gLzeNpGhE=",
|
"checksumSHA1": "P5PZ3k7SmqWmxgJ8Q0gLzeNpGhE=",
|
||||||
"path": "github.com/hashicorp/hil/parser",
|
"path": "github.com/hashicorp/hil/parser",
|
||||||
"revision": "60db937199ba6f67251aa038cec18ce36a951312",
|
"revision": "5b8d13c8c5c2753e109fab25392a1dbfa2db93d2",
|
||||||
"revisionTime": "2016-12-09T17:20:46Z"
|
"revisionTime": "2016-12-21T19:20:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "DC1k5kOua4oFqmo+JRt0YzfP44o=",
|
"checksumSHA1": "DC1k5kOua4oFqmo+JRt0YzfP44o=",
|
||||||
"path": "github.com/hashicorp/hil/scanner",
|
"path": "github.com/hashicorp/hil/scanner",
|
||||||
"revision": "60db937199ba6f67251aa038cec18ce36a951312",
|
"revision": "5b8d13c8c5c2753e109fab25392a1dbfa2db93d2",
|
||||||
"revisionTime": "2016-12-09T17:20:46Z"
|
"revisionTime": "2016-12-21T19:20:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "github.com/hashicorp/logutils",
|
"path": "github.com/hashicorp/logutils",
|
||||||
|
Loading…
Reference in New Issue
Block a user