mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9759 from ethereum/develop
Merge develop into breaking.
This commit is contained in:
commit
559ab3f1ec
@ -107,14 +107,17 @@ defaults:
|
||||
|
||||
- run_soltest: &run_soltest
|
||||
name: soltest
|
||||
no_output_timeout: 30m
|
||||
command: ./.circleci/soltest.sh
|
||||
|
||||
- run_soltest_all: &run_soltest_all
|
||||
name: soltest_all
|
||||
no_output_timeout: 30m
|
||||
command: ./.circleci/soltest_all.sh
|
||||
|
||||
- run_cmdline_tests: &run_cmdline_tests
|
||||
name: command line tests
|
||||
no_output_timeout: 30m
|
||||
command: ./test/cmdlineTests.sh
|
||||
|
||||
- run_docs_pragma_min_version: &run_docs_pragma_min_version
|
||||
@ -163,7 +166,6 @@ defaults:
|
||||
at: build
|
||||
- run:
|
||||
<<: *run_soltest
|
||||
no_output_timeout: 30m
|
||||
- store_test_results: *store_test_results
|
||||
- store_artifacts: *artifacts_test_results
|
||||
|
||||
@ -175,7 +177,6 @@ defaults:
|
||||
at: build
|
||||
- run:
|
||||
<<: *run_soltest
|
||||
no_output_timeout: 30m
|
||||
- store_test_results: *store_test_results
|
||||
- store_artifacts: *artifacts_test_results
|
||||
|
||||
@ -709,7 +710,6 @@ jobs:
|
||||
at: build
|
||||
- run:
|
||||
<<: *run_cmdline_tests
|
||||
no_output_timeout: 30m
|
||||
- store_test_results: *store_test_results
|
||||
- store_artifacts: *artifacts_test_results
|
||||
|
||||
@ -745,6 +745,7 @@ jobs:
|
||||
apt-get install -qqy --no-install-recommends nodejs npm cvc4
|
||||
- run:
|
||||
name: Test solcjs
|
||||
no_output_timeout: 30m
|
||||
command: |
|
||||
node --version
|
||||
npm --version
|
||||
|
@ -12,7 +12,8 @@ Compiler Features:
|
||||
* Yul Optimizer: Prune unused parameters in functions.
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Type Checker: Disallow ``virtual`` for modifiers in libraries.
|
||||
* ViewPureChecker: Prevent visibility check on constructors.
|
||||
|
||||
### 0.7.1 (2020-09-02)
|
||||
|
||||
|
@ -320,6 +320,15 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
|
||||
|
||||
void TypeChecker::endVisit(ModifierDefinition const& _modifier)
|
||||
{
|
||||
if (_modifier.virtualSemantics())
|
||||
if (auto const* contractDef = dynamic_cast<ContractDefinition const*>(_modifier.scope()))
|
||||
if (contractDef->isLibrary())
|
||||
m_errorReporter.typeError(
|
||||
3275_error,
|
||||
_modifier.location(),
|
||||
"Modifiers in a library cannot be virtual."
|
||||
);
|
||||
|
||||
if (!_modifier.isImplemented() && !_modifier.virtualSemantics())
|
||||
m_errorReporter.typeError(8063_error, _modifier.location(), "Modifiers without implementation must be marked virtual.");
|
||||
}
|
||||
|
@ -261,21 +261,24 @@ void ViewPureChecker::reportMutability(
|
||||
{
|
||||
// We do not warn for library functions because they cannot be payable anyway.
|
||||
// Also internal functions should be allowed to use `msg.value`.
|
||||
if (m_currentFunction->isPublic() && !m_currentFunction->libraryFunction())
|
||||
if ((m_currentFunction->isConstructor() || m_currentFunction->isPublic()) && !m_currentFunction->libraryFunction())
|
||||
{
|
||||
if (_nestedLocation)
|
||||
m_errorReporter.typeError(
|
||||
4006_error,
|
||||
_location,
|
||||
SecondarySourceLocation().append("\"msg.value\" or \"callvalue()\" appear here inside the modifier.", *_nestedLocation),
|
||||
"This modifier uses \"msg.value\" or \"callvalue()\" and thus the function has to be payable or internal."
|
||||
m_currentFunction->isConstructor() ?
|
||||
"This modifier uses \"msg.value\" or \"callvalue()\" and thus the constructor has to be payable."
|
||||
: "This modifier uses \"msg.value\" or \"callvalue()\" and thus the function has to be payable or internal."
|
||||
);
|
||||
else
|
||||
m_errorReporter.typeError(
|
||||
5887_error,
|
||||
_location,
|
||||
"\"msg.value\" and \"callvalue()\" can only be used in payable public functions. Make the function "
|
||||
"\"payable\" or use an internal function to avoid this error."
|
||||
m_currentFunction->isConstructor() ?
|
||||
"\"msg.value\" and \"callvalue()\" can only be used in payable constructors. Make the constructor \"payable\" to avoid this error."
|
||||
: "\"msg.value\" and \"callvalue()\" can only be used in payable public functions. Make the function \"payable\" or use an internal function to avoid this error."
|
||||
);
|
||||
m_errors = true;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ private:
|
||||
void visitStatements(std::vector<Statement> const& _statements);
|
||||
|
||||
/// Pops all variables declared in the block and checks that the stack height is equal
|
||||
/// to @a _blackStartStackHeight.
|
||||
/// to @a _blockStartStackHeight.
|
||||
void finalizeBlock(Block const& _block, int _blockStartStackHeight);
|
||||
|
||||
void generateMultiAssignment(std::vector<Identifier> const& _variableNames);
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/**
|
||||
* Optimiser component that changes the code of a black so that all non-function definition
|
||||
* Optimiser component that changes the code of a block so that all non-function definition
|
||||
* instructions are moved to a block of their own followed by all function definitions.
|
||||
*/
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
uint256 value;
|
||||
constructor() {
|
||||
value = msg.value;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5887: (68-77): "msg.value" and "callvalue()" can only be used in payable constructors. Make the constructor "payable" to avoid this error.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function get() public view returns(uint256) {
|
||||
return msg.value;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5887: (78-87): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error.
|
@ -0,0 +1,7 @@
|
||||
library test {
|
||||
modifier m virtual;
|
||||
function f() m public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 3275: (19-38): Modifiers in a library cannot be virtual.
|
Loading…
Reference in New Issue
Block a user