From c5640fb1255f8a4be2faa042a073c0994d903060 Mon Sep 17 00:00:00 2001 From: wechman Date: Tue, 30 Aug 2022 10:44:38 +0200 Subject: [PATCH] Unify vocabulary related to the feature. --- libsolidity/analysis/TypeChecker.cpp | 2 +- libsolidity/ast/AST.h | 8 ++++---- ...l => bind_function_as_a_member_and_as_an_operator.sol} | 0 .../operators/custom/operator_bound_to_enum.sol | 2 +- ... => two_argument_function_bound_to_unary_operator.sol} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename test/libsolidity/semanticTests/using/{attach_function_as_a_member_and_as_an_operator.sol => bind_function_as_a_member_and_as_an_operator.sol} (100%) rename test/libsolidity/syntaxTests/operators/custom/{unary_operator_attached_to_two_argument_function.sol => two_argument_function_bound_to_unary_operator.sol} (100%) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 9dd0f7155..06b98d69c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -3872,7 +3872,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor) m_errorReporter.typeError( 9921_error, _usingFor.location(), - "The \"using\" directive cannot be used to attach functions to enum types." + "The \"using\" directive cannot be used to bind functions to enum types." ); Type const* normalizedType = TypeProvider::withLocationIfReference( diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 7a9ced43c..fccacce1e 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -645,11 +645,11 @@ private: /** * Using for directive: * - * 1. `using LibraryName for T` attaches all functions from the library `LibraryName` to the type `T` - * 2. `using LibraryName for *` attaches to all types. - * 3. `using {f1, f2, ..., fn} for T` attaches the functions `f1`, `f2`, ..., + * 1. `using LibraryName for T` binds all functions from the library `LibraryName` to the type `T` + * 2. `using LibraryName for *` binds to all types. + * 3. `using {f1, f2, ..., fn} for T` binds the functions `f1`, `f2`, ..., * `fn`, respectively to `T`. - * 4. `using {f1 as op1, f2 as op2, ..., fn as opn} for T` bounds operator `opn` to function `fn` for type `T`. + * 4. `using {f1 as op1, f2 as op2, ..., fn as opn} for T` binds function `fn` to operator `opn` for type `T`. * * For version 3, T has to be implicitly convertible to the first parameter type of * all functions, and this is checked at the point of the using statement. For versions 1 and diff --git a/test/libsolidity/semanticTests/using/attach_function_as_a_member_and_as_an_operator.sol b/test/libsolidity/semanticTests/using/bind_function_as_a_member_and_as_an_operator.sol similarity index 100% rename from test/libsolidity/semanticTests/using/attach_function_as_a_member_and_as_an_operator.sol rename to test/libsolidity/semanticTests/using/bind_function_as_a_member_and_as_an_operator.sol diff --git a/test/libsolidity/syntaxTests/operators/custom/operator_bound_to_enum.sol b/test/libsolidity/syntaxTests/operators/custom/operator_bound_to_enum.sol index 045922c38..3a1520da5 100644 --- a/test/libsolidity/syntaxTests/operators/custom/operator_bound_to_enum.sol +++ b/test/libsolidity/syntaxTests/operators/custom/operator_bound_to_enum.sol @@ -10,4 +10,4 @@ function add(E, E) pure returns (E) { } // ---- -// TypeError 9921: (0-23): The "using" directive cannot be used to attach functions to enum types. +// TypeError 9921: (0-23): The "using" directive cannot be used to bind functions to enum types. diff --git a/test/libsolidity/syntaxTests/operators/custom/unary_operator_attached_to_two_argument_function.sol b/test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol similarity index 100% rename from test/libsolidity/syntaxTests/operators/custom/unary_operator_attached_to_two_argument_function.sol rename to test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol