opentofu/internal/lang
Martin Atkins d4776e8ef1 lang/funcs: type conversion functions can convert null values
We had intended these functions to attempt to convert any given value, but
there is a special behavior in the function system where functions must
opt in to being able to handle dynamically-typed arguments so that we
don't need to repeat the special case for that inside every function
implementation.

In this case we _do_ want to specially handle dynamically-typed values,
because the keyword "null" in HCL produces
cty.NullVal(cty.DynamicPseudoType) and we want the conversion function
to convert it to a null of a more specific type.

These conversion functions are already just a thin wrapper around the
underlying type conversion functionality anyway, and that already supports
converting dynamic-typed values in the expected way, so we can just opt
in to allowing dynamically-typed values and let the conversion
functionality do the expected work.

Fixing this allows module authors to use type conversion functions to
give additional type information to Terraform in situations that are too
ambiguous to be handled automatically by the type inference/unification
process. Previously tostring(null) was effectively a no-op, totally
ignoring the author's request to treat the null as a string.
2022-04-20 09:09:12 -07:00
..
blocktoattr refine the skipFixup heuristic 2021-09-22 16:29:50 -04:00
funcs lang/funcs: type conversion functions can convert null values 2022-04-20 09:09:12 -07:00
globalref track contributing instances 2022-03-17 09:35:36 -04:00
marks Fix problems caught by staticcheck v0.3.0 2022-04-04 08:12:44 -07:00
testdata/functions-test Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
types lang: Further limit the console-only type function 2022-02-10 06:12:58 -05:00
data_test.go addrs: Rename AbsModuleCallOutput to ModuleCallInstanceOutput 2021-07-01 08:28:02 -07:00
data.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
doc.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
eval_test.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
eval.go core: Document postconditions as valid use of self 2022-01-31 14:34:35 -05:00
functions_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
functions.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
references.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
scope.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00