@@ -19,17 +19,17 @@ import (
1919 "fmt"
2020 "math/big"
2121
22- "github.com/zclconf /go-cty/cty"
23- ctyjson "github.com/zclconf /go-cty/cty/json"
22+ "github.com/hashicorp /go-cty/cty"
23+ ctyjson "github.com/hashicorp /go-cty/cty/json"
2424)
2525
2626// Wrap a cty.Value as Value.
27- func FromCtyValue (v cty.Value ) Value {
27+ func FromHCtyValue (v cty.Value ) Value {
2828 return ctyValueShim (v )
2929}
3030
3131// Wrap a cty.Type as Type.
32- func FromCtyType (v cty.Type ) Type {
32+ func FromHCtyType (v cty.Type ) Type {
3333 return ctyTypeShim (v )
3434}
3535
@@ -50,7 +50,7 @@ func (v ctyValueShim) GoString() string {
5050}
5151
5252func (v ctyValueShim ) Type () Type {
53- return FromCtyType (v .val ().Type ())
53+ return FromHCtyType (v .val ().Type ())
5454}
5555
5656func (v ctyValueShim ) StringValue () string {
@@ -62,8 +62,7 @@ func (v ctyValueShim) BoolValue() bool {
6262}
6363
6464func (v ctyValueShim ) NumberValue () float64 {
65- bf := v .BigFloatValue ()
66- f , _ := bf .Float64 ()
65+ f , _ := v .val ().AsBigFloat ().Float64 ()
6766 return f
6867}
6968
@@ -109,7 +108,7 @@ func (v ctyValueShim) Marshal(schemaType Type) (json.RawMessage, error) {
109108 tt , ok := schemaType .(ctyTypeShim )
110109 if ! ok {
111110 return nil , fmt .Errorf ("Cannot marshal to RawState: " +
112- "expected schemaType to be of type ctyTypeShim , got %#T" ,
111+ "expected schemaType to be of type hctyTypeShim , got %#T" ,
113112 schemaType )
114113 }
115114 raw , err := ctyjson .Marshal (vv , tt .ty ())
@@ -167,15 +166,15 @@ func (t ctyTypeShim) AttributeType(name string) (Type, bool) {
167166 if ! tt .HasAttribute (name ) {
168167 return nil , false
169168 }
170- return FromCtyType (tt .AttributeType (name )), true
169+ return FromHCtyType (tt .AttributeType (name )), true
171170}
172171
173172func (t ctyTypeShim ) ElementType () (Type , bool ) {
174173 tt := t .ty ()
175174 if ! tt .IsCollectionType () {
176175 return nil , false
177176 }
178- return FromCtyType (tt .ElementType ()), true
177+ return FromHCtyType (tt .ElementType ()), true
179178}
180179
181180func (t ctyTypeShim ) GoString () string {
0 commit comments