Skip to content

Commit 40de2b0

Browse files
committed
Add full stops to error messages
1 parent 19ad8b1 commit 40de2b0

File tree

56 files changed

+169
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+169
-170
lines changed

libsolidity/analysis/TypeChecker.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,8 @@ bool TypeChecker::visit(Assignment const& _assignment)
16011601
" not compatible with types " +
16021602
t->humanReadableName() +
16031603
" and " +
1604-
type(_assignment.rightHandSide())->humanReadableName()
1604+
type(_assignment.rightHandSide())->humanReadableName() +
1605+
"."
16051606
);
16061607
}
16071608
return false;
@@ -1723,9 +1724,7 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
17231724
TypeResult result = type(_operation.subExpression())->unaryOperatorResult(op);
17241725
if (!result)
17251726
{
1726-
string description = "Unary operator " + string(TokenTraits::toString(op)) + " cannot be applied to type " + subExprType->humanReadableName();
1727-
if (!result.message().empty())
1728-
description += ". " + result.message();
1727+
string description = "Unary operator " + string(TokenTraits::toString(op)) + " cannot be applied to type " + subExprType->humanReadableName() + "." + (!result.message().empty() ? " " + result.message() : "");
17291728
if (modifying)
17301729
// Cannot just report the error, ignore the unary operator, and continue,
17311730
// because the sub-expression was already processed with requireLValue()
@@ -1759,8 +1758,8 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
17591758
" not compatible with types " +
17601759
leftType->humanReadableName() +
17611760
" and " +
1762-
rightType->humanReadableName() +
1763-
(!result.message().empty() ? ". " + result.message() : "")
1761+
rightType->humanReadableName() + "." +
1762+
(!result.message().empty() ? " " + result.message() : "")
17641763
);
17651764
commonType = leftType;
17661765
}

test/libsolidity/syntaxTests/abiEncoder/abi_encodeCall_tuple_from_invalid_operator.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ contract C {
1515
}
1616
}
1717
// ----
18-
// TypeError 2271: (284-299): Operator + not compatible with types tuple(int_const 1,int_const 1) and tuple(int_const 2,int_const 2)
18+
// TypeError 2271: (284-299): Operator + not compatible with types tuple(int_const 1,int_const 1) and tuple(int_const 2,int_const 2).
1919
// TypeError 9062: (284-299): Expected an inline tuple, not an expression of a tuple type.
20-
// TypeError 2271: (334-345): Operator / not compatible with types tuple() and tuple()
20+
// TypeError 2271: (334-345): Operator / not compatible with types tuple() and tuple().
2121
// TypeError 9062: (334-345): Expected an inline tuple, not an expression of a tuple type.
22-
// TypeError 4907: (380-383): Unary operator ! cannot be applied to type tuple()
22+
// TypeError 4907: (380-383): Unary operator ! cannot be applied to type tuple().
2323
// TypeError 9062: (380-383): Expected an inline tuple, not an expression of a tuple type.

test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_comparison.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ contract C {
1919
}
2020
}
2121
// ----
22-
// TypeError 2271: (144-157): Operator != not compatible with types type(contract super C) and contract C
23-
// TypeError 2271: (167-180): Operator != not compatible with types contract C and type(contract super C)
24-
// TypeError 2271: (254-264): Operator != not compatible with types type(contract super C) and contract C
25-
// TypeError 2271: (274-284): Operator != not compatible with types contract C and type(contract super C)
26-
// TypeError 2271: (349-359): Operator != not compatible with types type(contract super C) and contract D
27-
// TypeError 2271: (369-379): Operator != not compatible with types contract D and type(contract super C)
22+
// TypeError 2271: (144-157): Operator != not compatible with types type(contract super C) and contract C.
23+
// TypeError 2271: (167-180): Operator != not compatible with types contract C and type(contract super C).
24+
// TypeError 2271: (254-264): Operator != not compatible with types type(contract super C) and contract C.
25+
// TypeError 2271: (274-284): Operator != not compatible with types contract C and type(contract super C).
26+
// TypeError 2271: (349-359): Operator != not compatible with types type(contract super C) and contract D.
27+
// TypeError 2271: (369-379): Operator != not compatible with types contract D and type(contract super C).

test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_operators.sol

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ contract C {
3030
}
3131
}
3232
// ----
33-
// TypeError 2271: (49-62): Operator << not compatible with types type(contract super C) and contract C
34-
// TypeError 2271: (72-85): Operator >> not compatible with types type(contract super C) and contract C
35-
// TypeError 2271: (95-107): Operator ^ not compatible with types type(contract super C) and contract C
36-
// TypeError 2271: (117-129): Operator | not compatible with types type(contract super C) and contract C
37-
// TypeError 2271: (139-151): Operator & not compatible with types type(contract super C) and contract C
38-
// TypeError 2271: (162-174): Operator * not compatible with types type(contract super C) and contract C
39-
// TypeError 2271: (184-196): Operator / not compatible with types type(contract super C) and contract C
40-
// TypeError 2271: (206-218): Operator % not compatible with types type(contract super C) and contract C
41-
// TypeError 2271: (228-240): Operator - not compatible with types type(contract super C) and contract C
42-
// TypeError 2271: (250-262): Operator + not compatible with types type(contract super C) and contract C
43-
// TypeError 2271: (272-285): Operator ** not compatible with types type(contract super C) and contract C
44-
// TypeError 2271: (296-309): Operator == not compatible with types type(contract super C) and contract C
45-
// TypeError 2271: (319-332): Operator != not compatible with types type(contract super C) and contract C
46-
// TypeError 2271: (342-355): Operator >= not compatible with types type(contract super C) and contract C
47-
// TypeError 2271: (365-378): Operator <= not compatible with types type(contract super C) and contract C
48-
// TypeError 2271: (388-400): Operator < not compatible with types type(contract super C) and contract C
49-
// TypeError 2271: (410-422): Operator > not compatible with types type(contract super C) and contract C
50-
// TypeError 2271: (433-446): Operator || not compatible with types type(contract super C) and contract C
51-
// TypeError 2271: (456-469): Operator && not compatible with types type(contract super C) and contract C
33+
// TypeError 2271: (49-62): Operator << not compatible with types type(contract super C) and contract C.
34+
// TypeError 2271: (72-85): Operator >> not compatible with types type(contract super C) and contract C.
35+
// TypeError 2271: (95-107): Operator ^ not compatible with types type(contract super C) and contract C.
36+
// TypeError 2271: (117-129): Operator | not compatible with types type(contract super C) and contract C.
37+
// TypeError 2271: (139-151): Operator & not compatible with types type(contract super C) and contract C.
38+
// TypeError 2271: (162-174): Operator * not compatible with types type(contract super C) and contract C.
39+
// TypeError 2271: (184-196): Operator / not compatible with types type(contract super C) and contract C.
40+
// TypeError 2271: (206-218): Operator % not compatible with types type(contract super C) and contract C.
41+
// TypeError 2271: (228-240): Operator - not compatible with types type(contract super C) and contract C.
42+
// TypeError 2271: (250-262): Operator + not compatible with types type(contract super C) and contract C.
43+
// TypeError 2271: (272-285): Operator ** not compatible with types type(contract super C) and contract C.
44+
// TypeError 2271: (296-309): Operator == not compatible with types type(contract super C) and contract C.
45+
// TypeError 2271: (319-332): Operator != not compatible with types type(contract super C) and contract C.
46+
// TypeError 2271: (342-355): Operator >= not compatible with types type(contract super C) and contract C.
47+
// TypeError 2271: (365-378): Operator <= not compatible with types type(contract super C) and contract C.
48+
// TypeError 2271: (388-400): Operator < not compatible with types type(contract super C) and contract C.
49+
// TypeError 2271: (410-422): Operator > not compatible with types type(contract super C) and contract C.
50+
// TypeError 2271: (433-446): Operator || not compatible with types type(contract super C) and contract C.
51+
// TypeError 2271: (456-469): Operator && not compatible with types type(contract super C) and contract C.
5252
// TypeError 4247: (480-485): Expression has to be an lvalue.
53-
// TypeError 7366: (480-493): Operator -= not compatible with types type(contract super C) and contract C
53+
// TypeError 7366: (480-493): Operator -= not compatible with types type(contract super C) and contract C.
5454
// TypeError 4247: (503-508): Expression has to be an lvalue.
55-
// TypeError 7366: (503-516): Operator += not compatible with types type(contract super C) and contract C
55+
// TypeError 7366: (503-516): Operator += not compatible with types type(contract super C) and contract C.
5656
// TypeError 1080: (527-546): True expression's type type(contract super C) does not match false expression's type contract C.

test/libsolidity/syntaxTests/errors/error_incompatible_binary_ops.sol

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ contract C {
2727
}
2828

2929
// ----
30-
// TypeError 2271: (86-116): Operator << not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
31-
// TypeError 2271: (126-156): Operator >> not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
32-
// TypeError 2271: (166-195): Operator ^ not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
33-
// TypeError 2271: (205-234): Operator | not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
34-
// TypeError 2271: (244-273): Operator & not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
35-
// TypeError 2271: (284-313): Operator * not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
36-
// TypeError 2271: (323-352): Operator / not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
37-
// TypeError 2271: (362-391): Operator % not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
38-
// TypeError 2271: (401-430): Operator + not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
39-
// TypeError 2271: (440-469): Operator - not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
40-
// TypeError 2271: (480-510): Operator == not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
41-
// TypeError 2271: (520-550): Operator != not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
42-
// TypeError 2271: (560-590): Operator >= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
43-
// TypeError 2271: (600-630): Operator <= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
44-
// TypeError 2271: (640-669): Operator < not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
45-
// TypeError 2271: (679-708): Operator > not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
46-
// TypeError 2271: (719-749): Operator || not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
47-
// TypeError 2271: (759-789): Operator && not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
30+
// TypeError 2271: (86-116): Operator << not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
31+
// TypeError 2271: (126-156): Operator >> not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
32+
// TypeError 2271: (166-195): Operator ^ not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
33+
// TypeError 2271: (205-234): Operator | not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
34+
// TypeError 2271: (244-273): Operator & not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
35+
// TypeError 2271: (284-313): Operator * not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
36+
// TypeError 2271: (323-352): Operator / not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
37+
// TypeError 2271: (362-391): Operator % not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
38+
// TypeError 2271: (401-430): Operator + not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
39+
// TypeError 2271: (440-469): Operator - not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
40+
// TypeError 2271: (480-510): Operator == not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
41+
// TypeError 2271: (520-550): Operator != not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
42+
// TypeError 2271: (560-590): Operator >= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
43+
// TypeError 2271: (600-630): Operator <= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
44+
// TypeError 2271: (640-669): Operator < not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
45+
// TypeError 2271: (679-708): Operator > not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
46+
// TypeError 2271: (719-749): Operator || not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).
47+
// TypeError 2271: (759-789): Operator && not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool).

test/libsolidity/syntaxTests/errors/error_incompatible_operator_for_type.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ contract C {
1212

1313
// ----
1414
// TypeError 4247: (102-115): Expression has to be an lvalue.
15-
// TypeError 7366: (102-120): Operator += not compatible with types error MyCustomError(uint256,bool) and int_const 1
15+
// TypeError 7366: (102-120): Operator += not compatible with types error MyCustomError(uint256,bool) and int_const 1.
1616
// TypeError 4247: (130-143): Expression has to be an lvalue.
17-
// TypeError 7366: (130-148): Operator -= not compatible with types error MyCustomError(uint256,bool) and int_const 1
18-
// TypeError 7366: (158-176): Operator += not compatible with types uint256 and error MyCustomError(uint256,bool)
19-
// TypeError 7366: (186-204): Operator -= not compatible with types uint256 and error MyCustomError(uint256,bool)
17+
// TypeError 7366: (130-148): Operator -= not compatible with types error MyCustomError(uint256,bool) and int_const 1.
18+
// TypeError 7366: (158-176): Operator += not compatible with types uint256 and error MyCustomError(uint256,bool).
19+
// TypeError 7366: (186-204): Operator -= not compatible with types uint256 and error MyCustomError(uint256,bool).

test/libsolidity/syntaxTests/errors/error_incompatible_unary_operator.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ contract C {
88

99
// ----
1010
// TypeError 4247: (86-99): Expression has to be an lvalue.
11-
// TypeError 9767: (86-101): Unary operator ++ cannot be applied to type error MyCustomError(uint256,bool)
11+
// TypeError 9767: (86-101): Unary operator ++ cannot be applied to type error MyCustomError(uint256,bool).

test/libsolidity/syntaxTests/events/event_incompatible_binary_ops.sol

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ contract C {
2626
}
2727

2828
// ----
29-
// TypeError 2271: (83-113): Operator << not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
30-
// TypeError 2271: (123-153): Operator >> not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
31-
// TypeError 2271: (163-192): Operator ^ not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
32-
// TypeError 2271: (202-231): Operator | not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
33-
// TypeError 2271: (241-270): Operator & not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
34-
// TypeError 2271: (281-310): Operator * not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
35-
// TypeError 2271: (320-349): Operator / not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
36-
// TypeError 2271: (359-388): Operator % not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
37-
// TypeError 2271: (398-427): Operator + not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
38-
// TypeError 2271: (437-466): Operator - not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
39-
// TypeError 2271: (477-507): Operator == not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
40-
// TypeError 2271: (517-547): Operator != not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
41-
// TypeError 2271: (557-587): Operator >= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
42-
// TypeError 2271: (597-627): Operator <= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
43-
// TypeError 2271: (637-666): Operator < not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
44-
// TypeError 2271: (676-705): Operator > not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
45-
// TypeError 2271: (716-746): Operator || not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
46-
// TypeError 2271: (756-786): Operator && not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
29+
// TypeError 2271: (83-113): Operator << not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
30+
// TypeError 2271: (123-153): Operator >> not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
31+
// TypeError 2271: (163-192): Operator ^ not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
32+
// TypeError 2271: (202-231): Operator | not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
33+
// TypeError 2271: (241-270): Operator & not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
34+
// TypeError 2271: (281-310): Operator * not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
35+
// TypeError 2271: (320-349): Operator / not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
36+
// TypeError 2271: (359-388): Operator % not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
37+
// TypeError 2271: (398-427): Operator + not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
38+
// TypeError 2271: (437-466): Operator - not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
39+
// TypeError 2271: (477-507): Operator == not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
40+
// TypeError 2271: (517-547): Operator != not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
41+
// TypeError 2271: (557-587): Operator >= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
42+
// TypeError 2271: (597-627): Operator <= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
43+
// TypeError 2271: (637-666): Operator < not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
44+
// TypeError 2271: (676-705): Operator > not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
45+
// TypeError 2271: (716-746): Operator || not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).
46+
// TypeError 2271: (756-786): Operator && not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256).

0 commit comments

Comments
 (0)