diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/zclconf/go-cty/cty/type.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/zclconf/go-cty/cty/type.go')
-rw-r--r-- | vendor/github.com/zclconf/go-cty/cty/type.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/vendor/github.com/zclconf/go-cty/cty/type.go b/vendor/github.com/zclconf/go-cty/cty/type.go index ae5f1c8..730cb98 100644 --- a/vendor/github.com/zclconf/go-cty/cty/type.go +++ b/vendor/github.com/zclconf/go-cty/cty/type.go | |||
@@ -19,7 +19,7 @@ type typeImpl interface { | |||
19 | 19 | ||
20 | // FriendlyName returns a human-friendly *English* name for the given | 20 | // FriendlyName returns a human-friendly *English* name for the given |
21 | // type. | 21 | // type. |
22 | FriendlyName() string | 22 | FriendlyName(mode friendlyTypeNameMode) string |
23 | 23 | ||
24 | // GoString implements the GoStringer interface from package fmt. | 24 | // GoString implements the GoStringer interface from package fmt. |
25 | GoString() string | 25 | GoString() string |
@@ -41,7 +41,25 @@ func (t Type) Equals(other Type) bool { | |||
41 | 41 | ||
42 | // FriendlyName returns a human-friendly *English* name for the given type. | 42 | // FriendlyName returns a human-friendly *English* name for the given type. |
43 | func (t Type) FriendlyName() string { | 43 | func (t Type) FriendlyName() string { |
44 | return t.typeImpl.FriendlyName() | 44 | return t.typeImpl.FriendlyName(friendlyTypeName) |
45 | } | ||
46 | |||
47 | // FriendlyNameForConstraint is similar to FriendlyName except that the | ||
48 | // result is specialized for describing type _constraints_ rather than types | ||
49 | // themselves. This is more appropriate when reporting that a particular value | ||
50 | // does not conform to an expected type constraint. | ||
51 | // | ||
52 | // In particular, this function uses the term "any type" to refer to | ||
53 | // cty.DynamicPseudoType, rather than "dynamic" as returned by FriendlyName. | ||
54 | func (t Type) FriendlyNameForConstraint() string { | ||
55 | return t.typeImpl.FriendlyName(friendlyTypeConstraintName) | ||
56 | } | ||
57 | |||
58 | // friendlyNameMode is an internal combination of the various FriendlyName* | ||
59 | // variants that just directly takes a mode, for easy passthrough for | ||
60 | // recursive name construction. | ||
61 | func (t Type) friendlyNameMode(mode friendlyTypeNameMode) string { | ||
62 | return t.typeImpl.FriendlyName(mode) | ||
45 | } | 63 | } |
46 | 64 | ||
47 | // GoString returns a string approximating how the receiver type would be | 65 | // GoString returns a string approximating how the receiver type would be |
@@ -93,3 +111,10 @@ func (t Type) HasDynamicTypes() bool { | |||
93 | panic("HasDynamicTypes does not support the given type") | 111 | panic("HasDynamicTypes does not support the given type") |
94 | } | 112 | } |
95 | } | 113 | } |
114 | |||
115 | type friendlyTypeNameMode rune | ||
116 | |||
117 | const ( | ||
118 | friendlyTypeName friendlyTypeNameMode = 'N' | ||
119 | friendlyTypeConstraintName friendlyTypeNameMode = 'C' | ||
120 | ) | ||