diff options
author | appilon <apilon@hashicorp.com> | 2019-02-27 16:43:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 16:43:31 -0500 |
commit | 844b5a68d8af4791755b8f0ad293cc99f5959183 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/zclconf/go-cty/cty/unknown.go | |
parent | 303b299eeb6b06e939e35905e4b34cb410dd9dc3 (diff) | |
parent | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (diff) | |
download | terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.gz terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.zst terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.zip |
Merge pull request #27 from terraform-providers/go-modules-2019-02-22
[MODULES] Switch to Go Modules
Diffstat (limited to 'vendor/github.com/zclconf/go-cty/cty/unknown.go')
-rw-r--r-- | vendor/github.com/zclconf/go-cty/cty/unknown.go | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/vendor/github.com/zclconf/go-cty/cty/unknown.go b/vendor/github.com/zclconf/go-cty/cty/unknown.go new file mode 100644 index 0000000..9f6fce9 --- /dev/null +++ b/vendor/github.com/zclconf/go-cty/cty/unknown.go | |||
@@ -0,0 +1,79 @@ | |||
1 | package cty | ||
2 | |||
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 { | ||
6 | } | ||
7 | |||
8 | // Unknown is a special value that can be | ||
9 | var unknown interface{} = &unknownType{} | ||
10 | |||
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. | ||
15 | // | ||
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 { | ||
19 | return Value{ | ||
20 | ty: t, | ||
21 | v: unknown, | ||
22 | } | ||
23 | } | ||
24 | |||
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 | ||
28 | // Value.GoString. | ||
29 | return "cty.unknown" | ||
30 | } | ||
31 | |||
32 | type pseudoTypeDynamic struct { | ||
33 | typeImplSigil | ||
34 | } | ||
35 | |||
36 | // DynamicPseudoType represents the dynamic pseudo-type. | ||
37 | // | ||
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. | ||
45 | // | ||
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 | ||
51 | |||
52 | func (t pseudoTypeDynamic) Equals(other Type) bool { | ||
53 | _, ok := other.typeImpl.(pseudoTypeDynamic) | ||
54 | return ok | ||
55 | } | ||
56 | |||
57 | func (t pseudoTypeDynamic) FriendlyName() string { | ||
58 | return "dynamic" | ||
59 | } | ||
60 | |||
61 | func (t pseudoTypeDynamic) GoString() string { | ||
62 | return "cty.DynamicPseudoType" | ||
63 | } | ||
64 | |||
65 | // DynamicVal is the only valid value of the pseudo-type dynamic. | ||
66 | // This value can be used as a placeholder where a value or expression's | ||
67 | // type and value are both unknown, thus allowing partial evaluation. See | ||
68 | // the docs for DynamicPseudoType for more information. | ||
69 | var DynamicVal Value | ||
70 | |||
71 | func init() { | ||
72 | DynamicPseudoType = Type{ | ||
73 | pseudoTypeDynamic{}, | ||
74 | } | ||
75 | DynamicVal = Value{ | ||
76 | ty: DynamicPseudoType, | ||
77 | v: unknown, | ||
78 | } | ||
79 | } | ||