opentofu/internal/typeexpr
Alisdair McDiarmid 650380f3ae configs: Add default argument to optional()
The optional modifier previously accepted a single argument: the
attribute type. This commit adds an optional second argument, which
specifies a default value for the attribute.

To record the default values for a variable's type, we use a separate
parallel structure of `typeexpr.Defaults`, rather than extending
`cty.Type` to include a `cty.Value` of defaults (which may in turn
include a `cty.Type` with defaults, and so on, and so forth).

The new `typeexpr.TypeConstraintWithDefaults` returns a type constraint
and defaults value. Defaults will be `nil` unless there are default
values specified somewhere in the variable's type.
2022-05-31 12:11:15 -04:00
..
defaults_test.go typeexpr: Add support for nested type defaults 2022-05-31 12:11:15 -04:00
defaults.go typeexpr: Add support for nested type defaults 2022-05-31 12:11:15 -04:00
doc.go configs: Experimental support for optional object type attributes 2020-10-12 10:12:28 -07:00
get_type_test.go configs: Add default argument to optional() 2022-05-31 12:11:15 -04:00
get_type.go configs: Add default argument to optional() 2022-05-31 12:11:15 -04:00
public.go configs: Add default argument to optional() 2022-05-31 12:11:15 -04:00
type_string_test.go typeexpr: Import tests from hashicorp/hcl 2022-04-27 14:16:33 -04:00
type_type_test.go typeexpr: Import tests from hashicorp/hcl 2022-04-27 14:16:33 -04:00
type_type.go configs: Experimental support for optional object type attributes 2020-10-12 10:12:28 -07:00