Skip to content

Commit 4e686c7

Browse files
committed
fix SetWithSemanticEquals.Equal()
1 parent 4dde122 commit 4e686c7

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

apstra/custom_types/set_with_semantic_equals_value.go

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,7 @@ func (s SetWithSemanticEquals) Equal(o attr.Value) bool {
2828
return false
2929
}
3030

31-
sType := s.ElementType(context.Background())
32-
oType := other.ElementType(context.Background())
33-
34-
// A set with no elementType is an invalid state
35-
if sType == nil || oType == nil {
36-
return false
37-
}
38-
39-
// element types must match
40-
if !sType.Equal(oType) {
41-
return false
42-
}
43-
44-
// states must mach
45-
if s.IsNull() != other.IsNull() || s.IsUnknown() != other.IsUnknown() {
46-
return false
47-
}
48-
49-
// unknown and null state have nothing more to check
50-
if s.IsNull() || s.IsUnknown() {
51-
return true
52-
}
53-
54-
if len(s.Elements()) != len(other.Elements()) {
55-
return false
56-
}
57-
58-
for _, elem := range s.Elements() {
59-
if !other.eqContains(elem) {
60-
return false
61-
}
62-
}
63-
64-
return true
31+
return s.SetValue.Equal(other.SetValue)
6532
}
6633

6734
func (s SetWithSemanticEquals) SetSemanticEquals(ctx context.Context, other basetypes.SetValuable) (bool, diag.Diagnostics) {

0 commit comments

Comments
 (0)