Skip to content

Commit

Permalink
Merge pull request #512 from onflow/bastian/cleanup
Browse files Browse the repository at this point in the history
Some minor improvements
  • Loading branch information
turbolent authored Feb 14, 2025
2 parents 1a31104 + 827ac1e commit 3909909
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion array.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ func (a *Array) Storable(_ SlabStorage, _ Address, maxInlineSize uint64) (Storab
return SlabIDStorable(a.SlabID()), nil

default:
panic("not reachable")
panic(NewUnreachableError())
}
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/smoke/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func modifyArray(
case arrayMutateChildContainerAfterAppend:
nextNestedLevels = nestedLevels - 1
default:
panic("not reachable")
panic(atree.NewUnreachableError())
}

// Create new chid child
Expand Down Expand Up @@ -366,7 +366,7 @@ func modifyArray(
case arrayMutateChildContainerAfterSet:
nextNestedLevels = nestedLevels - 1
default:
panic("not reachable")
panic(atree.NewUnreachableError())
}

// Create new child child
Expand Down Expand Up @@ -425,7 +425,7 @@ func modifyArray(
case arrayMutateChildContainerAfterInsert:
nextNestedLevels = nestedLevels - 1
default:
panic("not reachable")
panic(atree.NewUnreachableError())
}

// Create new child child
Expand Down
3 changes: 2 additions & 1 deletion cmd/smoke/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ func main() {
var err error
seed, err = strconv.ParseInt(strings.ReplaceAll(flagSeedHex, "0x", ""), 16, 64)
if err != nil {
panic("Failed to parse seed flag (hex string)")
fmt.Fprintf(os.Stderr, "failed to parse seed flag (hex string) %s: %s", flagSeedHex, err)
return
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/smoke/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func modifyMap(
case mapMutateChildContainerAfterSet:
nextNestedLevels = nestedLevels - 1
default:
panic("not reachable")
panic(atree.NewUnreachableError())
}

var expectedKey, key atree.Value
Expand Down Expand Up @@ -416,7 +416,7 @@ func modifyMap(

case mapRemoveOp:
if m.Type().IsComposite() {
panic("not reachable")
panic(atree.NewUnreachableError())
}

// Use for-range on Go map to get random key
Expand Down
2 changes: 1 addition & 1 deletion cmd/smoke/typeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func newCompositeTypeInfo() compositeTypeInfo {

endIndex := startIndex + count
if endIndex > len(compositeFieldNames) {
panic("not reachable")
panic(atree.NewUnreachableError())
}

return compositeTypeInfo{fieldStartIndex: startIndex, fieldEndIndex: endIndex}
Expand Down
2 changes: 1 addition & 1 deletion map.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ func (m *OrderedMap) Storable(_ SlabStorage, _ Address, maxInlineSize uint64) (S
return SlabIDStorable(m.SlabID()), nil

default:
panic("not reachable")
panic(NewUnreachableError())
}
}

Expand Down
6 changes: 3 additions & 3 deletions test_utils/expected_value_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ExpectedArrayValue []atree.Value
var _ atree.Value = &ExpectedArrayValue{}

func (v ExpectedArrayValue) Storable(atree.SlabStorage, atree.Address, uint64) (atree.Storable, error) {
panic("not reachable")
panic(atree.NewUnreachableError())
}

// ExpectedMapValue
Expand All @@ -42,7 +42,7 @@ type ExpectedMapValue map[atree.Value]atree.Value
var _ atree.Value = &ExpectedMapValue{}

func (v ExpectedMapValue) Storable(atree.SlabStorage, atree.Address, uint64) (atree.Storable, error) {
panic("not reachable")
panic(atree.NewUnreachableError())
}

// ExpectedWrapperValue
Expand All @@ -58,7 +58,7 @@ func NewExpectedWrapperValue(value atree.Value) ExpectedWrapperValue {
}

func (v ExpectedWrapperValue) Storable(atree.SlabStorage, atree.Address, uint64) (atree.Storable, error) {
panic("not reachable")
panic(atree.NewUnreachableError())
}

func ValueEqual(expected atree.Value, actual atree.Value) (bool, error) {
Expand Down

0 comments on commit 3909909

Please sign in to comment.