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
|
- run_soltest: &run_soltest
|
||||||
name: soltest
|
name: soltest
|
||||||
|
no_output_timeout: 30m
|
||||||
command: ./.circleci/soltest.sh
|
command: ./.circleci/soltest.sh
|
||||||
|
|
||||||
- run_soltest_all: &run_soltest_all
|
- run_soltest_all: &run_soltest_all
|
||||||
name: soltest_all
|
name: soltest_all
|
||||||
|
no_output_timeout: 30m
|
||||||
command: ./.circleci/soltest_all.sh
|
command: ./.circleci/soltest_all.sh
|
||||||
|
|
||||||
- run_cmdline_tests: &run_cmdline_tests
|
- run_cmdline_tests: &run_cmdline_tests
|
||||||
name: command line tests
|
name: command line tests
|
||||||
|
no_output_timeout: 30m
|
||||||
command: ./test/cmdlineTests.sh
|
command: ./test/cmdlineTests.sh
|
||||||
|
|
||||||
- run_docs_pragma_min_version: &run_docs_pragma_min_version
|
- run_docs_pragma_min_version: &run_docs_pragma_min_version
|
||||||
@ -163,7 +166,6 @@ defaults:
|
|||||||
at: build
|
at: build
|
||||||
- run:
|
- run:
|
||||||
<<: *run_soltest
|
<<: *run_soltest
|
||||||
no_output_timeout: 30m
|
|
||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
@ -175,7 +177,6 @@ defaults:
|
|||||||
at: build
|
at: build
|
||||||
- run:
|
- run:
|
||||||
<<: *run_soltest
|
<<: *run_soltest
|
||||||
no_output_timeout: 30m
|
|
||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
@ -709,7 +710,6 @@ jobs:
|
|||||||
at: build
|
at: build
|
||||||
- run:
|
- run:
|
||||||
<<: *run_cmdline_tests
|
<<: *run_cmdline_tests
|
||||||
no_output_timeout: 30m
|
|
||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
@ -745,6 +745,7 @@ jobs:
|
|||||||
apt-get install -qqy --no-install-recommends nodejs npm cvc4
|
apt-get install -qqy --no-install-recommends nodejs npm cvc4
|
||||||
- run:
|
- run:
|
||||||
name: Test solcjs
|
name: Test solcjs
|
||||||
|
no_output_timeout: 30m
|
||||||
command: |
|
command: |
|
||||||
node --version
|
node --version
|
||||||
npm --version
|
npm --version
|
||||||
|
@ -12,7 +12,8 @@ Compiler Features:
|
|||||||
* Yul Optimizer: Prune unused parameters in functions.
|
* Yul Optimizer: Prune unused parameters in functions.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Type Checker: Disallow ``virtual`` for modifiers in libraries.
|
||||||
|
* ViewPureChecker: Prevent visibility check on constructors.
|
||||||
|
|
||||||
### 0.7.1 (2020-09-02)
|
### 0.7.1 (2020-09-02)
|
||||||
|
|
||||||
|
@ -320,6 +320,15 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
|
|||||||
|
|
||||||
void TypeChecker::endVisit(ModifierDefinition const& _modifier)
|
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())
|
if (!_modifier.isImplemented() && !_modifier.virtualSemantics())
|
||||||
m_errorReporter.typeError(8063_error, _modifier.location(), "Modifiers without implementation must be marked virtual.");
|
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.
|
// We do not warn for library functions because they cannot be payable anyway.
|
||||||
// Also internal functions should be allowed to use `msg.value`.
|
// 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)
|
if (_nestedLocation)
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
4006_error,
|
4006_error,
|
||||||
_location,
|
_location,
|
||||||
SecondarySourceLocation().append("\"msg.value\" or \"callvalue()\" appear here inside the modifier.", *_nestedLocation),
|
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
|
else
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
5887_error,
|
5887_error,
|
||||||
_location,
|
_location,
|
||||||
"\"msg.value\" and \"callvalue()\" can only be used in payable public functions. Make the function "
|
m_currentFunction->isConstructor() ?
|
||||||
"\"payable\" or use an internal function to avoid this error."
|
"\"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;
|
m_errors = true;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ private:
|
|||||||
void visitStatements(std::vector<Statement> const& _statements);
|
void visitStatements(std::vector<Statement> const& _statements);
|
||||||
|
|
||||||
/// Pops all variables declared in the block and checks that the stack height is equal
|
/// 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 finalizeBlock(Block const& _block, int _blockStartStackHeight);
|
||||||
|
|
||||||
void generateMultiAssignment(std::vector<Identifier> const& _variableNames);
|
void generateMultiAssignment(std::vector<Identifier> const& _variableNames);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// 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.
|
* 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