Skip to content

Commit 4c9a58e

Browse files
wechmancameel
authored andcommitted
Don't include location in a message about binding function to a type
1 parent d5428af commit 4c9a58e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

libsolidity/analysis/TypeChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3798,7 +3798,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
37983798
path->location(),
37993799
"The function \"" + joinHumanReadable(path->path(), ".") + "\" " +
38003800
"does not have any parameters, and therefore cannot be bound to the type \"" +
3801-
(normalizedType ? normalizedType->humanReadableName() : "*") + "\"."
3801+
(normalizedType ? normalizedType->toString(true /* withoutDataLocation */) : "*") + "\"."
38023802
);
38033803

38043804
FunctionType const* functionType = dynamic_cast<FunctionType const&>(*functionDefinition.type()).asBoundFunction();
@@ -3811,7 +3811,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
38113811
3100_error,
38123812
path->location(),
38133813
"The function \"" + joinHumanReadable(path->path(), ".") + "\" "+
3814-
"cannot be bound to the type \"" + _usingFor.typeName()->annotation().type->humanReadableName() +
3814+
"cannot be bound to the type \"" + _usingFor.typeName()->annotation().type->toString(true /* withoutDataLocation */) +
38153815
"\" because the type cannot be implicitly converted to the first argument" +
38163816
" of the function (\"" + functionType->selfType()->humanReadableName() + "\")" +
38173817
(

test/libsolidity/syntaxTests/using/free_functions_implicit_conversion_err.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ contract C {
1111
}
1212
// ----
1313
// TypeError 3100: (112-114): The function "id" cannot be bound to the type "uint256" because the type cannot be implicitly converted to the first argument of the function ("uint16").
14-
// TypeError 3100: (140-142): The function "id" cannot be bound to the type "struct S storage pointer" because the type cannot be implicitly converted to the first argument of the function ("uint16").
14+
// TypeError 3100: (140-142): The function "id" cannot be bound to the type "struct S" because the type cannot be implicitly converted to the first argument of the function ("uint16").
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
struct S { uint8 x; }
2+
function f() {}
3+
using {f} for S;
4+
// ----
5+
// TypeError 4731: (45-46): The function "f" does not have any parameters, and therefore cannot be bound to the type "struct S".

0 commit comments

Comments
 (0)