File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -2927,12 +2927,12 @@ func (v *ArrayValue) Reverse(
29272927 common.ZeroAddress,
29282928 uint64(count),
29292929 func() Value {
2930- if idx < 0 {
2930+ if index < 0 {
29312931 return nil
29322932 }
29332933
2934- value := v.Get(interpreter, locationRange, idx )
2935- idx --
2934+ value := v.Get(interpreter, locationRange, index )
2935+ index --
29362936
29372937 return value.Transfer(
29382938 interpreter,
Original file line number Diff line number Diff line change @@ -2225,7 +2225,7 @@ func ArraySliceFunctionType(elementType Type) *FunctionType {
22252225 }
22262226}
22272227
2228- func ArrayReverseFunctionType (arrayType sema. ArrayType ) * FunctionType {
2228+ func ArrayReverseFunctionType (arrayType ArrayType ) * FunctionType {
22292229 return & FunctionType {
22302230 Parameters : []Parameter {},
22312231 ReturnTypeAnnotation : NewTypeAnnotation (arrayType ),
Original file line number Diff line number Diff line change @@ -1117,14 +1117,15 @@ func TestCheckResourceArrayReverseInvalid(t *testing.T) {
11171117
11181118 fun test(): @[X] {
11191119 let xs <- [<-create X()]
1120- return <-xs.reverse()
1120+ let revxs <-xs.reverse()
1121+ destroy xs
1122+ return <- revxs
11211123 }
11221124 ` )
11231125
1124- errs := RequireCheckerErrors (t , err , 2 )
1126+ errs := RequireCheckerErrors (t , err , 1 )
11251127
11261128 assert .IsType (t , & sema.InvalidResourceArrayMemberError {}, errs [0 ])
1127- assert .IsType (t , & sema.ResourceLossError {}, errs [1 ])
11281129}
11291130
11301131func TestCheckArrayContains (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments