mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 07:33:32 -06:00
691b98b612
The console-only `type` function allows interrogation of any value's type. An implementation quirk is that we use a cty.Mark to allow the console to display this type information without the usual HCL quoting. For example: > type("boop") string instead of: > type("boop") "string" Because these marks can propagate when used in complex expressions, using the type function as part of a complex expression could result in this "print as raw" mark being attached to a collection. When this happened, it would result in a crash when we tried to iterate over a marked value. The `type` function was never intended to be used in this way, which is why its use is limited to the console command. Its purpose was as a pseudo-builtin, used only at the top level to display the type of a given value. This commit goes some way to preventing the use of the `type` function in complex expressions, by refusing to display any non-string value which was marked by `type`, or contains a sub-value which was so marked. |
||
---|---|---|
.. | ||
testdata/config-fixture | ||
format_test.go | ||
format.go | ||
repl.go | ||
session_test.go | ||
session.go |