3 // unknownType is the placeholder type used for the sigil value representing
4 // "Unknown", to make it unambigiously distinct from any other possible value.
5 type unknownType struct {
8 // Unknown is a special value that can be
9 var unknown interface{} = &unknownType{}
11 // UnknownVal returns an Value that represents an unknown value of the given
12 // type. Unknown values can be used to represent a value that is
13 // not yet known. Its meaning is undefined in cty, but it could be used by
14 // an calling application to allow partial evaluation.
16 // Unknown values of any type can be created of any type. All operations on
17 // Unknown values themselves return Unknown.
18 func UnknownVal(t Type) Value {
25 func (t unknownType) GoString() string {
26 // This is the stringification of our internal unknown marker. The
27 // stringification of the public representation of unknowns is in
32 type pseudoTypeDynamic struct {
36 // DynamicPseudoType represents the dynamic pseudo-type.
38 // This type can represent situations where a type is not yet known. Its
39 // meaning is undefined in cty, but it could be used by a calling
40 // application to allow expression type checking with some types not yet known.
41 // For example, the application might optimistically permit any operation on
42 // values of this type in type checking, allowing a partial type-check result,
43 // and then repeat the check when more information is known to get the
44 // final, concrete type.
46 // It is a pseudo-type because it is used only as a sigil to the calling
47 // application. "Unknown" is the only valid value of this pseudo-type, so
48 // operations on values of this type will always short-circuit as per
49 // the rules for that special value.
50 var DynamicPseudoType Type
52 func (t pseudoTypeDynamic) Equals(other Type) bool {
53 _, ok := other.typeImpl.(pseudoTypeDynamic)
57 func (t pseudoTypeDynamic) FriendlyName(mode friendlyTypeNameMode) string {
59 case friendlyTypeConstraintName:
66 func (t pseudoTypeDynamic) GoString() string {
67 return "cty.DynamicPseudoType"
70 // DynamicVal is the only valid value of the pseudo-type dynamic.
71 // This value can be used as a placeholder where a value or expression's
72 // type and value are both unknown, thus allowing partial evaluation. See
73 // the docs for DynamicPseudoType for more information.
77 DynamicPseudoType = Type{
81 ty: DynamicPseudoType,