mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tone down error message.
This commit is contained in:
parent
7886c24d40
commit
1a1db1ec96
@ -215,13 +215,13 @@ void ViewPureChecker::reportMutability(StateMutability _mutability, SourceLocati
|
|||||||
string text;
|
string text;
|
||||||
if (_mutability == StateMutability::View)
|
if (_mutability == StateMutability::View)
|
||||||
text =
|
text =
|
||||||
"Function declared as pure, but this expression reads from the "
|
"Function declared as pure, but this expression (potentially) reads from the "
|
||||||
"environment or state and thus requires \"view\".";
|
"environment or state and thus requires \"view\".";
|
||||||
else if (_mutability == StateMutability::NonPayable)
|
else if (_mutability == StateMutability::NonPayable)
|
||||||
text =
|
text =
|
||||||
"Function declared as " +
|
"Function declared as " +
|
||||||
stateMutabilityToString(m_currentFunction->stateMutability()) +
|
stateMutabilityToString(m_currentFunction->stateMutability()) +
|
||||||
", but this expression modifies the state and thus "
|
", but this expression (potentially) modifies the state and thus "
|
||||||
"requires non-payable (the default) or payable.";
|
"requires non-payable (the default) or payable.";
|
||||||
else
|
else
|
||||||
solAssert(false, "");
|
solAssert(false, "");
|
||||||
|
@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(call_internal_functions_fail)
|
|||||||
CHECK_ERROR(
|
CHECK_ERROR(
|
||||||
"contract C{ function f() pure { g(); } function g() view {} }",
|
"contract C{ function f() pure { g(); } function g() view {} }",
|
||||||
TypeError,
|
TypeError,
|
||||||
"Function declared as pure, but this expression reads from the environment or state and thus requires \"view\""
|
"Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires \"view\""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(write_storage_fail)
|
|||||||
{
|
{
|
||||||
CHECK_WARNING(
|
CHECK_WARNING(
|
||||||
"contract C{ uint x; function f() view { x = 2; } }",
|
"contract C{ uint x; function f() view { x = 2; } }",
|
||||||
"Function declared as view, but this expression modifies the state and thus requires non-payable (the default) or payable."
|
"Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(environment_access)
|
|||||||
CHECK_ERROR(
|
CHECK_ERROR(
|
||||||
"contract C { function f() pure { var x = " + x + "; x; } }",
|
"contract C { function f() pure { var x = " + x + "; x; } }",
|
||||||
TypeError,
|
TypeError,
|
||||||
"Function declared as pure, but this expression reads from the environment or state and thus requires \"view\""
|
"Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires \"view\""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (string const& x: pure)
|
for (string const& x: pure)
|
||||||
|
Loading…
Reference in New Issue
Block a user