diff --git a/runtime/interpreter/value.go b/runtime/interpreter/value.go index e028c31ec..0a13a1296 100644 --- a/runtime/interpreter/value.go +++ b/runtime/interpreter/value.go @@ -2412,14 +2412,14 @@ func (v *ArrayValue) GetMember(interpreter *Interpreter, locationRange LocationR }, ) - case sema.ArrayTypeReversedFunctionName: + case sema.ArrayTypeReverseFunctionName: return NewHostFunctionValue( interpreter, - sema.ArrayReversedFunctionType( + sema.ArrayReverseFunctionType( v.SemaType(interpreter).ElementType(false), ), func(invocation Invocation) Value { - return v.Reversed( + return v.Reverse( invocation.Interpreter, invocation.LocationRange, ) @@ -2884,7 +2884,7 @@ func (v *ArrayValue) Slice( ) } -func (v *ArrayValue) Reversed( +func (v *ArrayValue) Reverse( interpreter *Interpreter, locationRange LocationRange, ) Value { diff --git a/runtime/sema/type.go b/runtime/sema/type.go index 068c2cc2d..42575115a 100644 --- a/runtime/sema/type.go +++ b/runtime/sema/type.go @@ -1788,10 +1788,11 @@ It does not modify the original array. If either of the parameters are out of the bounds of the array, or the indices are invalid (` + "`from > upTo`" + `), then the function will fail. ` -const ArrayTypeReversedFunctionName = "reversed" +const ArrayTypeReverseFunctionName = "reverse" -const arrayTypeReversedFunctionDocString = ` +const arrayTypeReverseFunctionDocString = ` Returns a new array with contents in the reversed order. +Available if the array element type is not resource-kinded. ` func getArrayMembers(arrayType ArrayType) map[string]MemberResolver { @@ -1887,7 +1888,7 @@ func getArrayMembers(arrayType ArrayType) map[string]MemberResolver { ) }, }, - ArrayTypeReversedFunctionName: { + ArrayTypeReverseFunctionName: { Kind: common.DeclarationKindFunction, Resolve: func(memoryGauge common.MemoryGauge, identifier string, targetRange ast.Range, report func(error)) *Member { elementType := arrayType.ElementType(false) @@ -1907,8 +1908,8 @@ func getArrayMembers(arrayType ArrayType) map[string]MemberResolver { memoryGauge, arrayType, identifier, - ArrayReversedFunctionType(elementType), - arrayTypeReversedFunctionDocString, + ArrayReverseFunctionType(elementType), + arrayTypeReverseFunctionDocString, ) }, }, @@ -2224,7 +2225,7 @@ func ArraySliceFunctionType(elementType Type) *FunctionType { } } -func ArrayReversedFunctionType(elementType Type) *FunctionType { +func ArrayReverseFunctionType(elementType Type) *FunctionType { return &FunctionType{ Parameters: []Parameter{}, ReturnTypeAnnotation: NewTypeAnnotation(&VariableSizedType{