mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-16 11:42:58 -06:00
1d35233a03
HIL implemented its type conversions by rewriting its AST to include calls to some undocumented builtin functions. Unfortunately those functions were still explicitly callable if you could figure out the name for them, and so they may have been used in the wild. In particular, __builtin_StringToFloat was used as part of a workaround for a HIL design flaw where it would prefer to convert strings to integers rather than floats when performing arithmetic operations. This issue was, indeed, the main reason for unifying int ant float into a single number type in HCL. Since we published that as a suggested workaround, the upgrade tool ought to fix it up. The other cases have never been documented as a workaround, so they are less likely to appear in the wild, but we might as well fix them up anyway since we already have the conversion functions required to get the same result in the new language. To be safe/conservative, most of these convert to _two_ function calls rather than just one, which ensures that these new expressions retain the behavior of implicitly converting to the source type before running the conversion. The new conversion functions only specify target type, and so cannot guarantee identical results if the argument type does not exactly match what was previously given as the parameter type in HIL. |
||
---|---|---|
.. | ||
test-fixtures | ||
analysis_expr.go | ||
analysis.go | ||
doc.go | ||
module_sources_test.go | ||
module_sources.go | ||
upgrade_body.go | ||
upgrade_expr.go | ||
upgrade_native.go | ||
upgrade_test.go | ||
upgrade.go | ||
upgrader.go |