aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.dockerignore6
-rw-r--r--docs/miscellaneous.rst1
-rw-r--r--docs/solidity-by-example.rst2
-rw-r--r--libjulia/Exceptions.h6
-rw-r--r--libjulia/backends/evm/AbstractAssembly.h2
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.cpp4
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.h12
-rw-r--r--libjulia/optimiser/ASTCopier.h2
-rw-r--r--libjulia/optimiser/Disambiguator.h2
-rw-r--r--libjulia/optimiser/README.md6
-rw-r--r--libjulia/optimiser/UnusedPruner.cpp4
-rw-r--r--libsolidity/analysis/TypeChecker.cpp28
-rw-r--r--libsolidity/ast/Types.cpp6
-rw-r--r--libsolidity/interface/CompilerStack.cpp50
-rw-r--r--libsolidity/interface/CompilerStack.h38
-rw-r--r--scripts/Dockerfile39
-rw-r--r--test/RPCSession.cpp2
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWallet.sol8
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol2
-rw-r--r--test/compilationTests/corion/ico.sol14
-rw-r--r--test/compilationTests/corion/module.sol2
-rw-r--r--test/compilationTests/corion/moduleHandler.sol6
-rw-r--r--test/compilationTests/corion/multiOwner.sol2
-rw-r--r--test/compilationTests/corion/owned.sol2
-rw-r--r--test/compilationTests/corion/premium.sol6
-rw-r--r--test/compilationTests/corion/provider.sol24
-rw-r--r--test/compilationTests/corion/publisher.sol2
-rw-r--r--test/compilationTests/corion/schelling.sol8
-rw-r--r--test/compilationTests/corion/token.sol16
-rw-r--r--test/compilationTests/gnosis/Events/CategoricalEvent.sol2
-rw-r--r--test/compilationTests/gnosis/Events/Event.sol4
-rw-r--r--test/compilationTests/gnosis/Events/EventFactory.sol4
-rw-r--r--test/compilationTests/gnosis/Events/ScalarEvent.sol2
-rw-r--r--test/compilationTests/gnosis/Markets/Campaign.sol8
-rw-r--r--test/compilationTests/gnosis/Markets/StandardMarket.sol4
-rw-r--r--test/compilationTests/gnosis/Migrations.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/CentralizedOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/DifficultyOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/FutarchyOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol4
-rw-r--r--test/compilationTests/gnosis/Oracles/MajorityOracle.sol4
-rw-r--r--test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/UltimateOracle.sol6
-rw-r--r--test/compilationTests/gnosis/Tokens/OutcomeToken.sol2
-rw-r--r--test/compilationTests/milestonetracker/MilestoneTracker.sol2
-rw-r--r--test/compilationTests/zeppelin/Bounty.sol2
-rw-r--r--test/compilationTests/zeppelin/DayLimit.sol2
-rw-r--r--test/compilationTests/zeppelin/LimitBalance.sol2
-rw-r--r--test/compilationTests/zeppelin/MultisigWallet.sol8
-rw-r--r--test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol2
-rw-r--r--test/compilationTests/zeppelin/crowdsale/Crowdsale.sol6
-rw-r--r--test/compilationTests/zeppelin/crowdsale/RefundVault.sol4
-rw-r--r--test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol2
-rw-r--r--test/compilationTests/zeppelin/lifecycle/Destructible.sol2
-rw-r--r--test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/Claimable.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/DelayedClaimable.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/HasNoEther.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/Ownable.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/Shareable.sol2
-rw-r--r--test/compilationTests/zeppelin/token/SimpleToken.sol2
-rw-r--r--test/compilationTests/zeppelin/token/TokenTimelock.sol2
-rw-r--r--test/contracts/AuctionRegistrar.cpp4
-rw-r--r--test/contracts/FixedFeeRegistrar.cpp2
-rw-r--r--test/contracts/Wallet.cpp4
-rwxr-xr-xtest/externalTests.sh7
-rw-r--r--test/libjulia/CommonSubexpression.cpp2
-rw-r--r--test/libjulia/Disambiguator.cpp2
-rw-r--r--test/libjulia/FunctionGrouper.cpp4
-rw-r--r--test/libjulia/FunctionHoister.cpp4
-rw-r--r--test/libjulia/Inliner.cpp20
-rw-r--r--test/libjulia/MainFunction.cpp4
-rw-r--r--test/libjulia/Parser.cpp2
-rw-r--r--test/libjulia/Rematerialiser.cpp2
-rw-r--r--test/libjulia/Simplifier.cpp2
-rw-r--r--test/libjulia/UnusedPruner.cpp2
-rw-r--r--test/libsolidity/ABIEncoderTests.cpp6
-rw-r--r--test/libsolidity/SMTChecker.cpp14
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp4
-rw-r--r--test/libsolidity/SolidityExpressionCompiler.cpp2
-rw-r--r--test/libsolidity/syntaxTests/deprecated_functions.sol4
-rw-r--r--test/libsolidity/syntaxTests/empty_string_var.sol11
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol6
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol3
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol3
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol22
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol16
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol11
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol8
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol31
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol16
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol12
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol10
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol3
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol4
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/else_if_statement.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/if_statement.sol10
-rw-r--r--test/libsolidity/syntaxTests/parsing/modifier.sol2
-rw-r--r--test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol36
-rw-r--r--test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples.sol27
-rw-r--r--test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol7
139 files changed, 416 insertions, 550 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..ab452ecf
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+# out-of-tree builds usually go here. This helps improving performance of uploading
+# the build context to the docker image build server
+/build
+
+# in-tree builds
+/deps
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 108d4c96..f6cfdc2c 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -79,6 +79,7 @@ Solidity always places new objects at the free memory pointer and memory is neve
.. warning::
There are some operations in Solidity that need a temporary memory area larger than 64 bytes and therefore will not fit into the scratch space. They will be placed where the free memory points to, but given their short lifecycle, the pointer is not updated. The memory may or may not be zeroed out. Because of this, one shouldn't expect the free memory to be zeroed out.
+ While it may seem like a good idea to use ``msize`` to arrive at a definitely zeroed out memory area, using such a pointer non-temporarily without updating the free memory pointer can have adverse results.
.. index: calldata layout
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 2b3d4b48..e8fddd61 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -496,7 +496,7 @@ high or low invalid bids.
if (value <= highestBid) {
return false;
}
- if (highestBidder != 0) {
+ if (highestBidder != address(0)) {
// Refund the previously highest bidder.
pendingReturns[highestBidder] += highestBid;
}
diff --git a/libjulia/Exceptions.h b/libjulia/Exceptions.h
index 20ab6520..48624a56 100644
--- a/libjulia/Exceptions.h
+++ b/libjulia/Exceptions.h
@@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * Exceptions in Julia.
+ * Exceptions in Yul.
*/
#pragma once
@@ -28,8 +28,8 @@ namespace dev
namespace julia
{
-struct IuliaException: virtual Exception {};
-struct OptimizerException: virtual IuliaException {};
+struct YulException: virtual Exception {};
+struct OptimizerException: virtual YulException {};
}
}
diff --git a/libjulia/backends/evm/AbstractAssembly.h b/libjulia/backends/evm/AbstractAssembly.h
index 8e90a912..46fa7796 100644
--- a/libjulia/backends/evm/AbstractAssembly.h
+++ b/libjulia/backends/evm/AbstractAssembly.h
@@ -42,7 +42,7 @@ namespace julia
{
///
-/// Assembly class that abstracts both the libevmasm assembly and the new julia evm assembly.
+/// Assembly class that abstracts both the libevmasm assembly and the new Yul assembly.
///
class AbstractAssembly
{
diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp
index 2a97429b..ba2d7f75 100644
--- a/libjulia/backends/evm/EVMCodeTransform.cpp
+++ b/libjulia/backends/evm/EVMCodeTransform.cpp
@@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * Common code generator for translating Julia / inline assembly to EVM and EVM1.5.
+ * Common code generator for translating Yul / inline assembly to EVM and EVM1.5.
*/
#include <libjulia/backends/evm/EVMCodeTransform.h>
@@ -331,7 +331,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
CodeTransform(
m_assembly,
m_info,
- m_julia,
+ m_yul,
m_evm15,
m_identifierAccess,
m_useNamedLabelsForFunctions,
diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h
index f8eec0b7..ed0785d3 100644
--- a/libjulia/backends/evm/EVMCodeTransform.h
+++ b/libjulia/backends/evm/EVMCodeTransform.h
@@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * Common code generator for translating Julia / inline assembly to EVM and EVM1.5.
+ * Common code generator for translating Yul / inline assembly to EVM and EVM1.5.
*/
#include <libjulia/backends/evm/EVMAssembly.h>
@@ -49,14 +49,14 @@ public:
CodeTransform(
julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
- bool _julia = false,
+ bool _yul = false,
bool _evm15 = false,
ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess(),
bool _useNamedLabelsForFunctions = false
): CodeTransform(
_assembly,
_analysisInfo,
- _julia,
+ _yul,
_evm15,
_identifierAccess,
_useNamedLabelsForFunctions,
@@ -78,7 +78,7 @@ protected:
CodeTransform(
julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
- bool _julia,
+ bool _yul,
bool _evm15,
ExternalIdentifierAccess const& _identifierAccess,
bool _useNamedLabelsForFunctions,
@@ -87,7 +87,7 @@ protected:
):
m_assembly(_assembly),
m_info(_analysisInfo),
- m_julia(_julia),
+ m_yul(_yul),
m_evm15(_evm15),
m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions),
m_identifierAccess(_identifierAccess),
@@ -142,7 +142,7 @@ private:
julia::AbstractAssembly& m_assembly;
solidity::assembly::AsmAnalysisInfo& m_info;
solidity::assembly::Scope* m_scope = nullptr;
- bool m_julia = false;
+ bool m_yul = false;
bool m_evm15 = false;
bool m_useNamedLabelsForFunctions = false;
ExternalIdentifierAccess m_identifierAccess;
diff --git a/libjulia/optimiser/ASTCopier.h b/libjulia/optimiser/ASTCopier.h
index 8681f2e0..cb2925e3 100644
--- a/libjulia/optimiser/ASTCopier.h
+++ b/libjulia/optimiser/ASTCopier.h
@@ -62,7 +62,7 @@ public:
};
/**
- * Creates a copy of a iulia AST potentially replacing identifier names.
+ * Creates a copy of a Yul AST potentially replacing identifier names.
* Base class to be extended.
*/
class ASTCopier: public ExpressionCopier, public StatementCopier
diff --git a/libjulia/optimiser/Disambiguator.h b/libjulia/optimiser/Disambiguator.h
index 6fc8a615..4ef43736 100644
--- a/libjulia/optimiser/Disambiguator.h
+++ b/libjulia/optimiser/Disambiguator.h
@@ -38,7 +38,7 @@ namespace julia
{
/**
- * Creates a copy of a iulia AST replacing all identifiers by unique names.
+ * Creates a copy of a Yul AST replacing all identifiers by unique names.
*/
class Disambiguator: public ASTCopier
{
diff --git a/libjulia/optimiser/README.md b/libjulia/optimiser/README.md
index 1b000294..b1ce8931 100644
--- a/libjulia/optimiser/README.md
+++ b/libjulia/optimiser/README.md
@@ -1,6 +1,6 @@
-## IULIA Optimiser
+## Yul Optimiser
-The iulia optimiser consists of several stages and components that all transform
+The Yul optimiser consists of several stages and components that all transform
the AST in a semantically equivalent way. The goal is to end up either with code
that is shorter or at least only marginally longer but will allow further
optimisation steps.
@@ -81,7 +81,7 @@ a loop or conditional, the first one is not inside), the first assignment is rem
## Expression Simplifier
-This step can only be applied for the EVM-flavoured dialect of iulia. It applies
+This step can only be applied for the EVM-flavoured dialect of Yul. It applies
simple rules like ``x + 0 == x`` to simplify expressions.
## Ineffective Statement Remover
diff --git a/libjulia/optimiser/UnusedPruner.cpp b/libjulia/optimiser/UnusedPruner.cpp
index 54e8fd6e..af503712 100644
--- a/libjulia/optimiser/UnusedPruner.cpp
+++ b/libjulia/optimiser/UnusedPruner.cpp
@@ -59,7 +59,7 @@ void UnusedPruner::operator()(Block& _block)
// Multi-variable declarations are special. We can only remove it
// if all vairables are unused and the right-hand-side is either
// movable or it return a single value. In the latter case, we
- // replace `let a := f()` by `pop(f())` (in pure IULIA, this will be
+ // replace `let a := f()` by `pop(f())` (in pure Yul, this will be
// `drop(f())`).
if (boost::algorithm::none_of(
varDecl.variables,
@@ -74,7 +74,7 @@ void UnusedPruner::operator()(Block& _block)
statement = Block{std::move(varDecl.location), {}};
}
else if (varDecl.variables.size() == 1)
- // In pure IULIA, this should be replaced by a function call to `drop`
+ // In pure Yul, this should be replaced by a function call to `drop`
// instead of `pop`.
statement = ExpressionStatement{varDecl.location, FunctionalInstruction{
varDecl.location,
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 19e931f2..b46d4849 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -2287,14 +2287,28 @@ void TypeChecker::endVisit(Literal const& _literal)
if (_literal.looksLikeAddress())
{
- if (_literal.passesAddressChecksum())
- _literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address);
- else
- m_errorReporter.warning(
+ // Assign type here if it even looks like an address. This prevents double error in 050 mode for invalid address
+ _literal.annotation().type = make_shared<IntegerType>(160, IntegerType::Modifier::Address);
+
+ string msg;
+ if (_literal.value().length() != 42) // "0x" + 40 hex digits
+ // looksLikeAddress enforces that it is a hex literal starting with "0x"
+ msg =
+ "This looks like an address but is not exactly 40 hex digits. It is " +
+ to_string(_literal.value().length() - 2) +
+ " hex digits.";
+ else if (!_literal.passesAddressChecksum())
+ {
+ msg = "This looks like an address but has an invalid checksum.";
+ if (!_literal.getChecksummedAddress().empty())
+ msg += " Correct checksummed address: \"" + _literal.getChecksummedAddress() + "\".";
+ }
+
+ if (!msg.empty())
+ m_errorReporter.syntaxError(
_literal.location(),
- "This looks like an address but has an invalid checksum. "
- "If this is not used as an address, please prepend '00'. " +
- (!_literal.getChecksummedAddress().empty() ? "Correct checksummed address: '" + _literal.getChecksummedAddress() + "'. " : "") +
+ msg +
+ " If this is not used as an address, please prepend '00'. " +
"For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals"
);
}
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index f9a4b7d6..69124705 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -860,11 +860,13 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const
{
case Category::Integer:
{
- if (m_value == rational(0))
- return true;
if (isFractional())
return false;
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_convertTo);
+ if (targetType.isAddress())
+ return false;
+ if (m_value == rational(0))
+ return true;
unsigned forSignBit = (targetType.isSigned() ? 1 : 0);
if (m_value > rational(0))
{
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 4e8d1461..aa33bad8 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -719,27 +719,10 @@ void CompilerStack::compileContract(
string metadata = createMetadata(compiledContract);
compiledContract.metadata = metadata;
- // Prepare CBOR metadata for the bytecode
- bytes cborEncodedHash =
- // CBOR-encoding of the key "bzzr0"
- bytes{0x65, 'b', 'z', 'z', 'r', '0'}+
- // CBOR-encoding of the hash
- bytes{0x58, 0x20} + dev::swarmHash(metadata).asBytes();
- bytes cborEncodedMetadata;
- if (onlySafeExperimentalFeaturesActivated(_contract.sourceUnit().annotation().experimentalFeatures))
- cborEncodedMetadata =
- // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata)}
- bytes{0xa1} +
- cborEncodedHash;
- else
- cborEncodedMetadata =
- // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata), "experimental": true}
- bytes{0xa2} +
- cborEncodedHash +
- bytes{0x6c, 'e', 'x', 'p', 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l', 0xf5};
- solAssert(cborEncodedMetadata.size() <= 0xffff, "Metadata too large");
- // 16-bit big endian length
- cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2);
+ bytes cborEncodedMetadata = createCBORMetadata(
+ metadata,
+ !onlySafeExperimentalFeaturesActivated(_contract.sourceUnit().annotation().experimentalFeatures)
+ );
try
{
@@ -901,6 +884,31 @@ string CompilerStack::createMetadata(Contract const& _contract) const
return jsonCompactPrint(meta);
}
+bytes CompilerStack::createCBORMetadata(string _metadata, bool _experimentalMode)
+{
+ bytes cborEncodedHash =
+ // CBOR-encoding of the key "bzzr0"
+ bytes{0x65, 'b', 'z', 'z', 'r', '0'}+
+ // CBOR-encoding of the hash
+ bytes{0x58, 0x20} + dev::swarmHash(_metadata).asBytes();
+ bytes cborEncodedMetadata;
+ if (_experimentalMode)
+ cborEncodedMetadata =
+ // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata), "experimental": true}
+ bytes{0xa2} +
+ cborEncodedHash +
+ bytes{0x6c, 'e', 'x', 'p', 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l', 0xf5};
+ else
+ cborEncodedMetadata =
+ // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata)}
+ bytes{0xa1} +
+ cborEncodedHash;
+ solAssert(cborEncodedMetadata.size() <= 0xffff, "Metadata too large");
+ // 16-bit big endian length
+ cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2);
+ return cborEncodedMetadata;
+}
+
string CompilerStack::computeSourceMapping(eth::AssemblyItems const& _items) const
{
string ret;
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index 018c61ec..4359c3fa 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -122,6 +122,8 @@ public:
m_optimizeRuns = _runs;
}
+ /// Set the EVM version used before running compile.
+ /// When called without an argument it will revert to the default version.
void setEVMVersion(EVMVersion _version = EVMVersion{});
/// Sets the list of requested contract names. If empty, no filtering is performed and every contract
@@ -240,9 +242,7 @@ public:
Json::Value gasEstimates(std::string const& _contractName) const;
private:
- /**
- * Information pertaining to one source unit, filled gradually during parsing and compilation.
- */
+ /// The state per source unit. Filled gradually during parsing.
struct Source
{
std::shared_ptr<Scanner> scanner;
@@ -251,13 +251,14 @@ private:
void reset() { scanner.reset(); ast.reset(); }
};
+ /// The state per contract. Filled gradually during compilation.
struct Contract
{
ContractDefinition const* contract = nullptr;
std::shared_ptr<Compiler> compiler;
- eth::LinkerObject object;
- eth::LinkerObject runtimeObject;
- eth::LinkerObject cloneObject;
+ eth::LinkerObject object; ///< Deployment object (includes the runtime sub-object).
+ eth::LinkerObject runtimeObject; ///< Runtime object.
+ eth::LinkerObject cloneObject; ///< Clone object (deprecated).
std::string metadata; ///< The metadata json that will be hashed into the chain.
mutable std::unique_ptr<Json::Value const> abi;
mutable std::unique_ptr<Json::Value const> userDocumentation;
@@ -272,8 +273,10 @@ private:
StringMap loadMissingSources(SourceUnit const& _ast, std::string const& _path);
std::string applyRemapping(std::string const& _path, std::string const& _context);
void resolveImports();
+
/// @returns the absolute path corresponding to @a _path relative to @a _reference.
static std::string absolutePath(std::string const& _path, std::string const& _reference);
+
/// Helper function to return path converted strings.
static std::string sanitizePath(std::string const& _path) { return boost::filesystem::path(_path).generic_string(); }
@@ -285,19 +288,42 @@ private:
ContractDefinition const& _contract,
std::map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts
);
+
+ /// Links all the known library addresses in the available objects. Any unknown
+ /// library will still be kept as an unlinked placeholder in the objects.
void link();
+ /// @returns the contract object for the given @a _contractName.
+ /// Can only be called after state is CompilationSuccessful.
Contract const& contract(std::string const& _contractName) const;
+
+ /// @returns the source object for the given @a _sourceName.
+ /// Can only be called after state is SourcesSet.
Source const& source(std::string const& _sourceName) const;
/// @returns the parsed contract with the supplied name. Throws an exception if the contract
/// does not exist.
ContractDefinition const& contractDefinition(std::string const& _contractName) const;
+ /// @returns the metadata JSON as a compact string for the given contract.
std::string createMetadata(Contract const& _contract) const;
+
+ /// @returns the metadata CBOR for the given serialised metadata JSON.
+ static bytes createCBORMetadata(std::string _metadata, bool _experimentalMode);
+
+ /// @returns the computer source mapping string.
std::string computeSourceMapping(eth::AssemblyItems const& _items) const;
+
+ /// @returns the contract ABI as a JSON object.
+ /// This will generate the JSON object and store it in the Contract object if it is not present yet.
Json::Value const& contractABI(Contract const&) const;
+
+ /// @returns the Natspec User documentation as a JSON object.
+ /// This will generate the JSON object and store it in the Contract object if it is not present yet.
Json::Value const& natspecUser(Contract const&) const;
+
+ /// @returns the Natspec Developer documentation as a JSON object.
+ /// This will generate the JSON object and store it in the Contract object if it is not present yet.
Json::Value const& natspecDev(Contract const&) const;
/// @returns the offset of the entry point of the given function into the list of assembly items
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 654a9f29..2b2de1e2 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -1,18 +1,39 @@
-FROM alpine
+FROM alpine AS build
MAINTAINER chriseth <chris@ethereum.org>
#Official solidity docker image
#Establish working directory as solidity
WORKDIR /solidity
+
+# Build dependencies
+ADD /scripts/install_deps.sh /solidity/scripts/install_deps.sh
+RUN ./scripts/install_deps.sh
+
#Copy working directory on travis to the image
COPY / $WORKDIR
-#Install dependencies, eliminate annoying warnings, and build release, delete all remaining points and statically link.
-RUN ./scripts/install_deps.sh && sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp &&\
-cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSOLC_LINK_STATIC=1 &&\
-make solc && install -s solc/solc /usr/bin &&\
-cd / && rm -rf solidity &&\
-apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev &&\
-rm -rf /var/cache/apk/*
+# Number of parallel jobs during build
+# or 0 for auto-computing (max(1, CPU_core_count * 2/3), a greedy value)
+ARG BUILD_CONCURRENCY="0"
+
+#Install dependencies, eliminate annoying warnings
+RUN sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp
+RUN cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSOLC_LINK_STATIC=1
+RUN make solc \
+ -j$(awk "BEGIN { \
+ if (${BUILD_CONCURRENCY} != 0) { \
+ print(${BUILD_CONCURRENCY}); \
+ } else { \
+ x=($(grep -c ^processor /proc/cpuinfo) * 2/3); \
+ if (x > 1) { \
+ printf(\"%d\n\", x); \
+ } else { \
+ print(1); \
+ } \
+ } \
+ }")
+RUN strip solc/solc
-ENTRYPOINT ["/usr/bin/solc"] \ No newline at end of file
+FROM scratch
+COPY --from=build /solidity/solc/solc /usr/bin/solc
+ENTRYPOINT ["/usr/bin/solc"]
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index 4671edf4..160b0047 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -245,6 +245,8 @@ void RPCSession::test_setChainParams(vector<string> const& _accounts)
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x1000000000000",
+ "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "nonce": "0x0000000000000042",
"difficulty": "1"
},
"accounts": {
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
index a6f67c7a..76b01188 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
@@ -50,7 +50,7 @@ contract MultiSigWallet {
}
modifier transactionExists(uint transactionId) {
- if (transactions[transactionId].destination == 0)
+ if (transactions[transactionId].destination == address(0))
throw;
_;
}
@@ -74,7 +74,7 @@ contract MultiSigWallet {
}
modifier notNull(address _address) {
- if (_address == 0)
+ if (_address == address(0))
throw;
_;
}
@@ -102,12 +102,12 @@ contract MultiSigWallet {
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
- function MultiSigWallet(address[] _owners, uint _required)
+ constructor(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
- if (isOwner[_owners[i]] || _owners[i] == 0)
+ if (isOwner[_owners[i]] || _owners[i] == address(0))
throw;
isOwner[_owners[i]] = true;
}
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
index 024d3ef4..d03a82f9 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
@@ -19,7 +19,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
- function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
+ constructor(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol
index c61e3448..81a6516e 100644
--- a/test/compilationTests/corion/ico.sol
+++ b/test/compilationTests/corion/ico.sol
@@ -50,7 +50,7 @@ contract ico is safeMath {
uint256 public totalMint;
uint256 public totalPremiumMint;
- function ico(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] genesisAddr, uint256[] genesisValue) {
+ constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] genesisAddr, uint256[] genesisValue) {
/*
Installation function.
@@ -162,7 +162,7 @@ contract ico is safeMath {
interest_s memory _idb;
address _addr = beneficiary;
uint256 _to = (block.number - startBlock) / interestBlockDelay;
- if ( _addr == 0x00 ) { _addr = msg.sender; }
+ if ( _addr == address(0x00) ) { _addr = msg.sender; }
require( block.number > icoDelay );
require( ! aborted );
@@ -257,7 +257,7 @@ contract ico is safeMath {
@premiumContractAddr Address of the corion premium token contract
*/
require( msg.sender == owner );
- require( tokenAddr == 0x00 && premiumAddr == 0x00 );
+ require( tokenAddr == address(0x00) && premiumAddr == address(0x00) );
tokenAddr = tokenContractAddr;
premiumAddr = premiumContractAddr;
}
@@ -281,7 +281,7 @@ contract ico is safeMath {
If they call the contract without any function then this process will be taken place.
*/
require( isICO() );
- require( buy(msg.sender, 0x00) );
+ require( buy(msg.sender, address(0x00)) );
}
function buy(address beneficiaryAddress, address affilateAddress) payable returns (bool success) {
@@ -300,9 +300,9 @@ contract ico is safeMath {
@affilateAddress The address of the person who offered who will get the referral reward. It can not be equal with the beneficiaryAddress.
*/
require( isICO() );
- if ( beneficiaryAddress == 0x00) { beneficiaryAddress = msg.sender; }
+ if ( beneficiaryAddress == address(0x00)) { beneficiaryAddress = msg.sender; }
if ( beneficiaryAddress == affilateAddress ) {
- affilateAddress = 0x00;
+ affilateAddress = address(0x00);
}
uint256 _value = msg.value;
if ( beneficiaryAddress.balance < 0.2 ether ) {
@@ -317,7 +317,7 @@ contract ico is safeMath {
totalMint = safeAdd(totalMint, _reward);
require( foundationAddress.send(_value * 10 / 100) );
uint256 extra;
- if ( affilateAddress != 0x00 && ( brought[affilateAddress].eth > 0 || interestDB[affilateAddress][0].amount > 0 ) ) {
+ if ( affilateAddress != address(0x00) && ( brought[affilateAddress].eth > 0 || interestDB[affilateAddress][0].amount > 0 ) ) {
affiliate[affilateAddress].weight = safeAdd(affiliate[affilateAddress].weight, _reward);
extra = affiliate[affilateAddress].weight;
uint256 rate;
diff --git a/test/compilationTests/corion/module.sol b/test/compilationTests/corion/module.sol
index 51fb8231..5f13215f 100644
--- a/test/compilationTests/corion/module.sol
+++ b/test/compilationTests/corion/module.sol
@@ -123,7 +123,7 @@ contract module {
@ret This is the module handler address or not
*/
- if ( moduleHandlerAddress == 0x00 ) { return true; }
+ if ( moduleHandlerAddress == address(0x00) ) { return true; }
if ( moduleStatus != status.Connected ) { return false; }
return addr == moduleHandlerAddress;
}
diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol
index d1f928c5..080f599c 100644
--- a/test/compilationTests/corion/moduleHandler.sol
+++ b/test/compilationTests/corion/moduleHandler.sol
@@ -35,8 +35,8 @@ contract moduleHandler is multiOwner, announcementTypes {
address public foundationAddress;
uint256 debugModeUntil = block.number + 1000000;
- function moduleHandler(address[] newOwners) multiOwner(newOwners) {}
+ constructor(address[] newOwners) multiOwner(newOwners) {}
function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) {
/*
Loading modulest to ModuleHandler.
@@ -73,7 +73,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( success && ! found );
(success, found, id) = getModuleIDByHash(input.name);
require( success && ! found );
- (success, found, id) = getModuleIDByAddress(0x00);
+ (success, found, id) = getModuleIDByAddress(address(0x00));
require( success );
if ( ! found ) {
id = modules.length;
@@ -92,7 +92,7 @@ contract moduleHandler is multiOwner, announcementTypes {
*/
(bool _success, bool _found, uint256 _id) = getModuleIDByName(name);
if ( _success && _found ) { return (true, true, modules[_id].addr); }
- return (true, false, 0x00);
+ return (true, false, address(0x00));
}
function getModuleIDByHash(bytes32 hashOfName) public constant returns( bool success, bool found, uint256 id ) {
/*
diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol
index b8436c8b..0a0a44c5 100644
--- a/test/compilationTests/corion/multiOwner.sol
+++ b/test/compilationTests/corion/multiOwner.sol
@@ -12,7 +12,7 @@ contract multiOwner is safeMath {
/*
Constructor
*/
- function multiOwner(address[] newOwners) {
+ constructor(address[] newOwners) {
for ( uint256 a=0 ; a<newOwners.length ; a++ ) {
_addOwner(newOwners[a]);
}
diff --git a/test/compilationTests/corion/owned.sol b/test/compilationTests/corion/owned.sol
index bd187775..4a5ba673 100644
--- a/test/compilationTests/corion/owned.sol
+++ b/test/compilationTests/corion/owned.sol
@@ -20,7 +20,7 @@ contract ownedDB {
@bool Owner has called the contract or not
*/
- if ( owner == 0x00 ) {
+ if ( owner == address(0x00) ) {
return true;
}
return owner == msg.sender;
diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol
index 2cf76088..9c29e700 100644
--- a/test/compilationTests/corion/premium.sol
+++ b/test/compilationTests/corion/premium.sol
@@ -40,7 +40,7 @@ contract premium is module, safeMath {
mapping(address => bool) public genesis;
- function premium(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] genesisAddr, uint256[] genesisValue) {
+ constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] genesisAddr, uint256[] genesisValue) {
/*
Setup function.
If an ICOaddress is defined then the balance of the genesis addresses will be set as well.
@@ -53,7 +53,7 @@ contract premium is module, safeMath {
@genesisValue Array of the balance of the genesis addresses
*/
super.registerModuleHandler(moduleHandler);
- require( dbAddress != 0x00 );
+ require( dbAddress != address(0x00) );
db = ptokenDB(dbAddress);
if ( ! forReplace ) {
require( db.replaceOwner(this) );
@@ -273,7 +273,7 @@ contract premium is module, safeMath {
@to For who?
@amount Amount
*/
- require( from != 0x00 && to != 0x00 && to != 0xa636a97578d26a3b76b060bbc18226d954cf3757 );
+ require( from != address(0x00) && to != address(0x00) && to != 0xa636A97578d26A3b76B060Bbc18226d954cf3757 );
require( ( ! isICO) || genesis[from] );
require( db.decrease(from, amount) );
require( db.increase(to, amount) );
diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol
index 2cdd760d..e6886622 100644
--- a/test/compilationTests/corion/provider.sol
+++ b/test/compilationTests/corion/provider.sol
@@ -118,7 +118,7 @@ contract provider is module, safeMath, announcementTypes {
uint256 private currentSchellingRound = 1;
- function provider(address _moduleHandler) {
+ constructor(address _moduleHandler) {
/*
Install function.
@@ -161,7 +161,7 @@ contract provider is module, safeMath, announcementTypes {
if ( schellingRound == 0 ) {
schellingRound = currentSchellingRound;
}
- if ( clients[addr].providerAddress != 0 ) {
+ if ( clients[addr].providerAddress != address(0x00) ) {
ProviderAddress = clients[addr].providerAddress;
ProviderHeight = clients[addr].providerHeight;
ConnectedOn = clients[addr].providerConnected;
@@ -233,7 +233,7 @@ contract provider is module, safeMath, announcementTypes {
@admin The admin’s address
*/
require( ! providers[msg.sender].data[providers[msg.sender].currentHeight].valid );
- require( clients[msg.sender].providerAddress == 0x00 );
+ require( clients[msg.sender].providerAddress == address(0x00) );
require( ! checkICO() );
if ( priv ) {
require( getTokenBalance(msg.sender) >= minFundsForPrivate );
@@ -245,7 +245,7 @@ contract provider is module, safeMath, announcementTypes {
providers[msg.sender].currentHeight++;
uint256 currHeight = providers[msg.sender].currentHeight;
providers[msg.sender].data[currHeight].valid = true;
- if ( admin == 0x00 ) {
+ if ( admin == address(0x00) ) {
providers[msg.sender].data[currHeight].admin = msg.sender;
} else {
providers[msg.sender].data[currHeight].admin = admin;
@@ -288,7 +288,7 @@ contract provider is module, safeMath, announcementTypes {
require( providers[addr].data[currHeight].valid );
require( checkCorrectRate(providers[addr].data[currHeight].priv, rate) );
require( providers[addr].data[currHeight].admin == msg.sender || msg.sender == addr );
- if ( admin != 0x00 ) {
+ if ( admin != address(0x00) ) {
require( msg.sender == addr );
providers[addr].data[currHeight].admin = admin;
}
@@ -419,7 +419,7 @@ contract provider is module, safeMath, announcementTypes {
*/
uint256 currHeight = providers[provider].currentHeight;
require( ! providers[msg.sender].data[currHeight].valid );
- require( clients[msg.sender].providerAddress == 0x00 );
+ require( clients[msg.sender].providerAddress == address(0x00) );
require( providers[provider].data[currHeight].valid );
if ( providers[provider].data[currHeight].priv ) {
require( providers[provider].data[currHeight].allowedUsers[msg.sender] &&
@@ -446,7 +446,7 @@ contract provider is module, safeMath, announcementTypes {
It is only possible to disconnect those providers who were connected by us before.
*/
address provider = clients[msg.sender].providerAddress;
- require( provider != 0x0 );
+ require( provider != address(0x00) );
uint256 currHeight = clients[msg.sender].providerHeight;
bool providerHasClosed = false;
if ( providers[provider].data[currHeight].close > 0 ) {
@@ -479,7 +479,7 @@ contract provider is module, safeMath, announcementTypes {
if ( providers[addr].data[providers[addr].currentHeight].valid ) {
uint256 a;
(reward, a) = getProviderReward(addr, 0);
- } else if ( clients[addr].providerAddress != 0x0 ) {
+ } else if ( clients[addr].providerAddress != address(0x00) ) {
reward = getClientReward(0);
}
}
@@ -504,14 +504,14 @@ contract provider is module, safeMath, announcementTypes {
address _beneficiary = beneficiary;
address _provider = provider;
if ( _limit == 0 ) { _limit = gasProtectMaxRounds; }
- if ( _beneficiary == 0x00 ) { _beneficiary = msg.sender; }
- if ( _provider == 0x00 ) { _provider = msg.sender; }
+ if ( _beneficiary == address(0x00) ) { _beneficiary = msg.sender; }
+ if ( _provider == address(0x00) ) { _provider = msg.sender; }
uint256 clientReward;
uint256 providerReward;
if ( providers[_provider].data[providers[_provider].currentHeight].valid ) {
require( providers[_provider].data[providers[_provider].currentHeight].admin == msg.sender || msg.sender == _provider );
(providerReward, clientReward) = getProviderReward(_provider, _limit);
- } else if ( clients[msg.sender].providerAddress != 0x00 ) {
+ } else if ( clients[msg.sender].providerAddress != address(0x00) ) {
clientReward = getClientReward(_limit);
} else {
throw;
@@ -745,7 +745,7 @@ contract provider is module, safeMath, announcementTypes {
@value Rate of the change.
@neg ype of the change. If it is TRUE then the balance has been decreased if it is FALSE then it has been increased.
*/
- if ( clients[addr].providerAddress != 0 ) {
+ if ( clients[addr].providerAddress != address(0x00) ) {
checkFloatingSupply(clients[addr].providerAddress, providers[clients[addr].providerAddress].currentHeight, ! neg, value);
if (clients[addr].lastSupplyID != currentSchellingRound) {
clients[addr].supply[currentSchellingRound] = TEMath(clients[addr].supply[clients[addr].lastSupplyID], value, neg);
diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol
index 98d5af2a..c7baa4df 100644
--- a/test/compilationTests/corion/publisher.sol
+++ b/test/compilationTests/corion/publisher.sol
@@ -61,7 +61,7 @@ contract publisher is announcementTypes, module, safeMath {
mapping (address => uint256[]) public opponents;
- function publisher(address moduleHandler) {
+ constructor(address moduleHandler) {
/*
Installation function. The installer will be registered in the admin list automatically
diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol
index 8f38ec64..e092e311 100644
--- a/test/compilationTests/corion/schelling.sol
+++ b/test/compilationTests/corion/schelling.sol
@@ -37,7 +37,7 @@ contract schellingDB is safeMath, schellingVars {
*/
address private owner;
function replaceOwner(address newOwner) external returns(bool) {
- require( owner == 0x00 || msg.sender == owner );
+ require( owner == address(0x00) || msg.sender == owner );
owner = newOwner;
return true;
}
@@ -45,7 +45,7 @@ contract schellingDB is safeMath, schellingVars {
/*
Constructor
*/
- function schellingDB() {
+ constructor() {
rounds.length = 2;
rounds[0].blockHeight = block.number;
currentSchellingRound = 1;
@@ -247,7 +247,7 @@ contract schelling is module, announcementTypes, schellingVars {
bytes1 public belowChar = 0x30;
schellingDB private db;
- function schelling(address _moduleHandler, address _db, bool _forReplace) {
+ constructor(address _moduleHandler, address _db, bool _forReplace) {
/*
Installation function.
@@ -407,7 +407,7 @@ contract schelling is module, announcementTypes, schellingVars {
uint256 funds = getFunds(msg.sender);
address _beneficiary = msg.sender;
- if (beneficiary != 0x0) { _beneficiary = beneficiary; }
+ if (beneficiary != address(0x00)) { _beneficiary = beneficiary; }
uint256 reward;
require( voter.rewards > 0 );
require( voter.status == voterStatus.base );
diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol
index 3a6a4598..bb141b52 100644
--- a/test/compilationTests/corion/token.sol
+++ b/test/compilationTests/corion/token.sol
@@ -48,7 +48,7 @@ contract token is safeMath, module, announcementTypes {
mapping(address => bool) public genesis;
- function token(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] genesisAddr, uint256[] genesisValue) payable {
+ constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] genesisAddr, uint256[] genesisValue) payable {
/*
Installation function
@@ -63,9 +63,9 @@ contract token is safeMath, module, announcementTypes {
@genesisValue Array of balance of genesis addresses
*/
super.registerModuleHandler(moduleHandler);
- require( dbAddr != 0x00 );
- require( icoContractAddr != 0x00 );
- require( exchangeContractAddress != 0x00 );
+ require( dbAddr != address(0x00) );
+ require( icoContractAddr != address(0x00) );
+ require( exchangeContractAddress != address(0x00) );
db = tokenDB(dbAddr);
icoAddr = icoContractAddr;
exchangeAddress = exchangeContractAddress;
@@ -325,7 +325,7 @@ contract token is safeMath, module, announcementTypes {
require( success );
require( db.balanceOf(from) >= amount + _fee );
}
- require( from != 0x00 && to != 0x00 && to != 0xa636a97578d26a3b76b060bbc18226d954cf3757 );
+ require( from != address(0x00) && to != address(0x00) && to != 0xa636A97578d26A3b76B060Bbc18226d954cf3757 );
require( ( ! isICO) || genesis[from] );
require( db.decrease(from, amount) );
require( db.increase(to, amount) );
@@ -374,7 +374,7 @@ contract token is safeMath, module, announcementTypes {
address _schellingAddr;
(_success, _found, _schellingAddr) = moduleHandler(moduleHandlerAddress).getModuleAddressByName('Schelling');
require( _success );
- if ( _schellingAddr != 0x00 && _found) {
+ if ( _schellingAddr != address(0x00) && _found) {
require( db.decrease(owner, _forSchelling) );
require( db.increase(_schellingAddr, _forSchelling) );
_burn(owner, _forBurn);
@@ -424,7 +424,7 @@ contract token is safeMath, module, announcementTypes {
@value Quantity
*/
require( db.increase(owner, value) );
- require( moduleHandler(moduleHandlerAddress).broadcastTransfer(0x00, owner, value) );
+ require( moduleHandler(moduleHandlerAddress).broadcastTransfer(address(0x00), owner, value) );
if ( isICO ) {
require( ico(icoAddr).setInterestDB(owner, db.balanceOf(owner)) );
}
@@ -453,7 +453,7 @@ contract token is safeMath, module, announcementTypes {
@value Quantity
*/
require( db.decrease(owner, value) );
- require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, 0x00, value) );
+ require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, address(0x00), value) );
Burn(owner, value);
}
diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol
index fbd1d744..6bcec271 100644
--- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol
+++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol
@@ -13,7 +13,7 @@ contract CategoricalEvent is Event {
/// @param _collateralToken Tokens used as collateral in exchange for outcome tokens
/// @param _oracle Oracle contract used to resolve the event
/// @param outcomeCount Number of event outcomes
- function CategoricalEvent(
+ constructor(
Token _collateralToken,
Oracle _oracle,
uint8 outcomeCount
diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol
index 9aa257c4..4d390d0e 100644
--- a/test/compilationTests/gnosis/Events/Event.sol
+++ b/test/compilationTests/gnosis/Events/Event.sol
@@ -33,11 +33,11 @@ contract Event {
/// @param _collateralToken Tokens used as collateral in exchange for outcome tokens
/// @param _oracle Oracle contract used to resolve the event
/// @param outcomeCount Number of event outcomes
- function Event(Token _collateralToken, Oracle _oracle, uint8 outcomeCount)
+ constructor(Token _collateralToken, Oracle _oracle, uint8 outcomeCount)
public
{
// Validate input
- require(address(_collateralToken) != 0 && address(_oracle) != 0 && outcomeCount >= 2);
+ require(address(_collateralToken) != address(0) && address(_oracle) != address(0) && outcomeCount >= 2);
collateralToken = _collateralToken;
oracle = _oracle;
// Create an outcome token for each outcome
diff --git a/test/compilationTests/gnosis/Events/EventFactory.sol b/test/compilationTests/gnosis/Events/EventFactory.sol
index dfb1a579..4779c6e4 100644
--- a/test/compilationTests/gnosis/Events/EventFactory.sol
+++ b/test/compilationTests/gnosis/Events/EventFactory.sol
@@ -37,7 +37,7 @@ contract EventFactory {
{
bytes32 eventHash = keccak256(collateralToken, oracle, outcomeCount);
// Event should not exist yet
- require(address(categoricalEvents[eventHash]) == 0);
+ require(address(categoricalEvents[eventHash]) == address(0));
// Create event
eventContract = new CategoricalEvent(
collateralToken,
@@ -65,7 +65,7 @@ contract EventFactory {
{
bytes32 eventHash = keccak256(collateralToken, oracle, lowerBound, upperBound);
// Event should not exist yet
- require(address(scalarEvents[eventHash]) == 0);
+ require(address(scalarEvents[eventHash]) == address(0));
// Create event
eventContract = new ScalarEvent(
collateralToken,
diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol
index 2e5718ef..3120090c 100644
--- a/test/compilationTests/gnosis/Events/ScalarEvent.sol
+++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol
@@ -28,7 +28,7 @@ contract ScalarEvent is Event {
/// @param _oracle Oracle contract used to resolve the event
/// @param _lowerBound Lower bound for event outcome
/// @param _upperBound Lower bound for event outcome
- function ScalarEvent(
+ constructor(
Token _collateralToken,
Oracle _oracle,
int _lowerBound,
diff --git a/test/compilationTests/gnosis/Markets/Campaign.sol b/test/compilationTests/gnosis/Markets/Campaign.sol
index 9aee1033..d2e841b1 100644
--- a/test/compilationTests/gnosis/Markets/Campaign.sol
+++ b/test/compilationTests/gnosis/Markets/Campaign.sol
@@ -70,7 +70,7 @@ contract Campaign {
/// @param _fee Market fee
/// @param _funding Initial funding for market
/// @param _deadline Campaign deadline
- function Campaign(
+ constructor(
Event _eventContract,
MarketFactory _marketFactory,
MarketMaker _marketMaker,
@@ -81,9 +81,9 @@ contract Campaign {
public
{
// Validate input
- require( address(_eventContract) != 0
- && address(_marketFactory) != 0
- && address(_marketMaker) != 0
+ require( address(_eventContract) != address(0)
+ && address(_marketFactory) != address(0)
+ && address(_marketMaker) != address(0)
&& _fee < FEE_RANGE
&& _funding > 0
&& now < _deadline);
diff --git a/test/compilationTests/gnosis/Markets/StandardMarket.sol b/test/compilationTests/gnosis/Markets/StandardMarket.sol
index b973119a..fc384d3a 100644
--- a/test/compilationTests/gnosis/Markets/StandardMarket.sol
+++ b/test/compilationTests/gnosis/Markets/StandardMarket.sol
@@ -38,11 +38,11 @@ contract StandardMarket is Market {
/// @param _eventContract Event contract
/// @param _marketMaker Market maker contract
/// @param _fee Market fee
- function StandardMarket(address _creator, Event _eventContract, MarketMaker _marketMaker, uint24 _fee)
+ constructor(address _creator, Event _eventContract, MarketMaker _marketMaker, uint24 _fee)
public
{
// Validate inputs
- require(address(_eventContract) != 0 && address(_marketMaker) != 0 && _fee < FEE_RANGE);
+ require(address(_eventContract) != address(0) && address(_marketMaker) != address(0) && _fee < FEE_RANGE);
creator = _creator;
createdAtBlock = block.number;
eventContract = _eventContract;
diff --git a/test/compilationTests/gnosis/Migrations.sol b/test/compilationTests/gnosis/Migrations.sol
index 7e7fe8d4..c7d09bd2 100644
--- a/test/compilationTests/gnosis/Migrations.sol
+++ b/test/compilationTests/gnosis/Migrations.sol
@@ -8,7 +8,7 @@ contract Migrations {
if (msg.sender == owner) _;
}
- function Migrations() {
+ constructor() {
owner = msg.sender;
}
diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
index 26acf526..08d8e159 100644
--- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
@@ -34,7 +34,7 @@ contract CentralizedOracle is Oracle {
*/
/// @dev Constructor sets owner address and IPFS hash
/// @param _ipfsHash Hash identifying off chain event description
- function CentralizedOracle(address _owner, bytes _ipfsHash)
+ constructor(address _owner, bytes _ipfsHash)
public
{
// Description hash cannot be null
diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol
index 87351dfa..a9933a8c 100644
--- a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol
@@ -22,7 +22,7 @@ contract DifficultyOracle is Oracle {
*/
/// @dev Contract constructor validates and sets target block number
/// @param _blockNumber Target block number
- function DifficultyOracle(uint _blockNumber)
+ constructor(uint _blockNumber)
public
{
// Block has to be in the future
diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol
index 524103d8..196d38c5 100644
--- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol
@@ -55,7 +55,7 @@ contract FutarchyOracle is Oracle {
/// @param marketMaker Market maker contract
/// @param fee Market fee
/// @param _deadline Decision deadline
- function FutarchyOracle(
+ constructor(
address _creator,
EventFactory eventFactory,
Token collateralToken,
diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol
index 62eab4f0..1415486c 100644
--- a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol
+++ b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol
@@ -33,10 +33,10 @@ contract FutarchyOracleFactory {
*/
/// @dev Constructor sets event factory contract
/// @param _eventFactory Event factory contract
- function FutarchyOracleFactory(EventFactory _eventFactory)
+ constructor(EventFactory _eventFactory)
public
{
- require(address(_eventFactory) != 0);
+ require(address(_eventFactory) != address(0));
eventFactory = _eventFactory;
}
diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
index 4b02c2de..24cf9dea 100644
--- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
@@ -16,14 +16,14 @@ contract MajorityOracle is Oracle {
*/
/// @dev Allows to create an oracle for a majority vote based on other oracles
/// @param _oracles List of oracles taking part in the majority vote
- function MajorityOracle(Oracle[] _oracles)
+ constructor(Oracle[] _oracles)
public
{
// At least 2 oracles should be defined
require(_oracles.length > 2);
for (uint i = 0; i < _oracles.length; i++)
// Oracle address cannot be null
- require(address(_oracles[i]) != 0);
+ require(address(_oracles[i]) != address(0));
oracles = _oracles;
}
diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
index d541ab46..9a7bba41 100644
--- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol
@@ -38,7 +38,7 @@ contract SignedMessageOracle is Oracle {
/// @param v Signature parameter
/// @param r Signature parameter
/// @param s Signature parameter
- function SignedMessageOracle(bytes32 _descriptionHash, uint8 v, bytes32 r, bytes32 s)
+ constructor(bytes32 _descriptionHash, uint8 v, bytes32 r, bytes32 s)
public
{
signer = ecrecover(_descriptionHash, v, r, s);
diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol
index fe8b4ec7..0127117c 100644
--- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol
@@ -46,7 +46,7 @@ contract UltimateOracle is Oracle {
/// @param _challengePeriod Time to challenge oracle outcome
/// @param _challengeAmount Amount to challenge the outcome
/// @param _frontRunnerPeriod Time to overbid the front-runner
- function UltimateOracle(
+ constructor(
Oracle _forwardedOracle,
Token _collateralToken,
uint8 _spreadMultiplier,
@@ -57,8 +57,8 @@ contract UltimateOracle is Oracle {
public
{
// Validate inputs
- require( address(_forwardedOracle) != 0
- && address(_collateralToken) != 0
+ require( address(_forwardedOracle) != address(0)
+ && address(_collateralToken) != address(0)
&& _spreadMultiplier >= 2
&& _challengePeriod > 0
&& _challengeAmount > 0
diff --git a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
index fd1fa590..4757c798 100644
--- a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
+++ b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
@@ -31,7 +31,7 @@ contract OutcomeToken is StandardToken {
* Public functions
*/
/// @dev Constructor sets events contract address
- function OutcomeToken()
+ constructor()
public
{
eventContract = msg.sender;
diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol
index 7a9158ae..10b182a3 100644
--- a/test/compilationTests/milestonetracker/MilestoneTracker.sol
+++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol
@@ -108,7 +108,7 @@ contract MilestoneTracker {
/// @param _arbitrator Address assigned to be the arbitrator
/// @param _donor Address assigned to be the donor
/// @param _recipient Address assigned to be the recipient
- function MilestoneTracker (
+ constructor (
address _arbitrator,
address _donor,
address _recipient
diff --git a/test/compilationTests/zeppelin/Bounty.sol b/test/compilationTests/zeppelin/Bounty.sol
index 4425b7a5..4c62a0b4 100644
--- a/test/compilationTests/zeppelin/Bounty.sol
+++ b/test/compilationTests/zeppelin/Bounty.sol
@@ -48,7 +48,7 @@ contract Bounty is PullPayment, Destructible {
*/
function claim(Target target) {
address researcher = researchers[target];
- if (researcher == 0) {
+ if (researcher == address(0)) {
throw;
}
// Check Target contract invariants
diff --git a/test/compilationTests/zeppelin/DayLimit.sol b/test/compilationTests/zeppelin/DayLimit.sol
index 3c8d5b0c..0bcb341a 100644
--- a/test/compilationTests/zeppelin/DayLimit.sol
+++ b/test/compilationTests/zeppelin/DayLimit.sol
@@ -15,7 +15,7 @@ contract DayLimit {
* @dev Constructor that sets the passed value as a dailyLimit.
* @param _limit uint256 to represent the daily limit.
*/
- function DayLimit(uint256 _limit) {
+ constructor(uint256 _limit) {
dailyLimit = _limit;
lastDay = today();
}
diff --git a/test/compilationTests/zeppelin/LimitBalance.sol b/test/compilationTests/zeppelin/LimitBalance.sol
index 57477c74..40edd014 100644
--- a/test/compilationTests/zeppelin/LimitBalance.sol
+++ b/test/compilationTests/zeppelin/LimitBalance.sol
@@ -15,7 +15,7 @@ contract LimitBalance {
* @dev Constructor that sets the passed value as a limit.
* @param _limit uint256 to represent the limit.
*/
- function LimitBalance(uint256 _limit) {
+ constructor(uint256 _limit) {
limit = _limit;
}
diff --git a/test/compilationTests/zeppelin/MultisigWallet.sol b/test/compilationTests/zeppelin/MultisigWallet.sol
index 939e70f2..00019f6b 100644
--- a/test/compilationTests/zeppelin/MultisigWallet.sol
+++ b/test/compilationTests/zeppelin/MultisigWallet.sol
@@ -25,8 +25,8 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved.
*/
- function MultisigWallet(address[] _owners, uint256 _required, uint256 _daylimit)
- Shareable(_owners, _required)
+ constructor(address[] _owners, uint256 _required, uint256 _daylimit)
+ Shareable(_owners, _required)
DayLimit(_daylimit) { }
/**
@@ -67,7 +67,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
}
// determine our operation hash.
_r = keccak256(msg.data, block.number);
- if (!confirm(_r) && txs[_r].to == 0) {
+ if (!confirm(_r) && txs[_r].to == address(0)) {
txs[_r].to = _to;
txs[_r].value = _value;
txs[_r].data = _data;
@@ -81,7 +81,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _h The transaction hash to approve.
*/
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
- if (txs[_h].to != 0) {
+ if (txs[_h].to != address(0)) {
if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) {
throw;
}
diff --git a/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol
index f04649f3..afae79b7 100644
--- a/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol
+++ b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol
@@ -12,7 +12,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 public cap;
- function CappedCrowdsale(uint256 _cap) {
+ constructor(uint256 _cap) {
cap = _cap;
}
diff --git a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol
index bee1efd2..7c0cb360 100644
--- a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol
+++ b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol
@@ -40,11 +40,11 @@ contract Crowdsale {
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
- function Crowdsale(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address _wallet) {
+ constructor(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address _wallet) {
require(_startBlock >= block.number);
require(_endBlock >= _startBlock);
require(_rate > 0);
- require(_wallet != 0x0);
+ require(_wallet != address(0x0));
token = createTokenContract();
startBlock = _startBlock;
@@ -67,7 +67,7 @@ contract Crowdsale {
// low level token purchase function
function buyTokens(address beneficiary) payable {
- require(beneficiary != 0x0);
+ require(beneficiary != address(0x0));
require(validPurchase());
uint256 weiAmount = msg.value;
diff --git a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol
index cc92ff9f..6a22ebde 100644
--- a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol
+++ b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol
@@ -22,8 +22,8 @@ contract RefundVault is Ownable {
event RefundsEnabled();
event Refunded(address indexed beneficiary, uint256 weiAmount);
- function RefundVault(address _wallet) {
- require(_wallet != 0x0);
+ constructor(address _wallet) {
+ require(_wallet != address(0x0));
wallet = _wallet;
state = State.Active;
}
diff --git a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol
index f45df1d3..5e798d45 100644
--- a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol
+++ b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol
@@ -21,7 +21,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
// refund vault used to hold funds while crowdsale is running
RefundVault public vault;
- function RefundableCrowdsale(uint256 _goal) {
+ constructor(uint256 _goal) {
vault = new RefundVault(wallet);
goal = _goal;
}
diff --git a/test/compilationTests/zeppelin/lifecycle/Destructible.sol b/test/compilationTests/zeppelin/lifecycle/Destructible.sol
index 3561e3b7..00492590 100644
--- a/test/compilationTests/zeppelin/lifecycle/Destructible.sol
+++ b/test/compilationTests/zeppelin/lifecycle/Destructible.sol
@@ -10,7 +10,7 @@ import "../ownership/Ownable.sol";
*/
contract Destructible is Ownable {
- function Destructible() payable { }
+ constructor() payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
diff --git a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
index fe0b46b6..f88a55aa 100644
--- a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
+++ b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
@@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol";
*/
contract TokenDestructible is Ownable {
- function TokenDestructible() payable { }
+ constructor() payable { }
/**
* @notice Terminate contract and refund to owner
diff --git a/test/compilationTests/zeppelin/ownership/Claimable.sol b/test/compilationTests/zeppelin/ownership/Claimable.sol
index d063502d..14d0ac6a 100644
--- a/test/compilationTests/zeppelin/ownership/Claimable.sol
+++ b/test/compilationTests/zeppelin/ownership/Claimable.sol
@@ -35,6 +35,6 @@ contract Claimable is Ownable {
*/
function claimOwnership() onlyPendingOwner {
owner = pendingOwner;
- pendingOwner = 0x0;
+ pendingOwner = address(0x0);
}
}
diff --git a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol
index f5fee614..93177dc6 100644
--- a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol
+++ b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol
@@ -36,7 +36,7 @@ contract DelayedClaimable is Claimable {
if ((block.number > end) || (block.number < start))
throw;
owner = pendingOwner;
- pendingOwner = 0x0;
+ pendingOwner = address(0x0);
end = 0;
}
diff --git a/test/compilationTests/zeppelin/ownership/HasNoEther.sol b/test/compilationTests/zeppelin/ownership/HasNoEther.sol
index 2bcaf1b8..8f9edc03 100644
--- a/test/compilationTests/zeppelin/ownership/HasNoEther.sol
+++ b/test/compilationTests/zeppelin/ownership/HasNoEther.sol
@@ -21,7 +21,7 @@ contract HasNoEther is Ownable {
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
- function HasNoEther() payable {
+ constructor() payable {
if(msg.value > 0) {
throw;
}
diff --git a/test/compilationTests/zeppelin/ownership/Ownable.sol b/test/compilationTests/zeppelin/ownership/Ownable.sol
index f1628454..0a2257d6 100644
--- a/test/compilationTests/zeppelin/ownership/Ownable.sol
+++ b/test/compilationTests/zeppelin/ownership/Ownable.sol
@@ -14,7 +14,7 @@ contract Ownable {
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
- function Ownable() {
+ constructor() {
owner = msg.sender;
}
diff --git a/test/compilationTests/zeppelin/ownership/Shareable.sol b/test/compilationTests/zeppelin/ownership/Shareable.sol
index b6cb1c16..a9c2fd5f 100644
--- a/test/compilationTests/zeppelin/ownership/Shareable.sol
+++ b/test/compilationTests/zeppelin/ownership/Shareable.sol
@@ -59,7 +59,7 @@ contract Shareable {
* @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved.
*/
- function Shareable(address[] _owners, uint256 _required) {
+ constructor(address[] _owners, uint256 _required) {
owners[1] = msg.sender;
ownerIndex[msg.sender] = 1;
for (uint256 i = 0; i < _owners.length; ++i) {
diff --git a/test/compilationTests/zeppelin/token/SimpleToken.sol b/test/compilationTests/zeppelin/token/SimpleToken.sol
index 898cb21d..a4ba9eb3 100644
--- a/test/compilationTests/zeppelin/token/SimpleToken.sol
+++ b/test/compilationTests/zeppelin/token/SimpleToken.sol
@@ -20,7 +20,7 @@ contract SimpleToken is StandardToken {
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
- function SimpleToken() {
+ constructor() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
diff --git a/test/compilationTests/zeppelin/token/TokenTimelock.sol b/test/compilationTests/zeppelin/token/TokenTimelock.sol
index 595bf8d0..e9f998ba 100644
--- a/test/compilationTests/zeppelin/token/TokenTimelock.sol
+++ b/test/compilationTests/zeppelin/token/TokenTimelock.sol
@@ -19,7 +19,7 @@ contract TokenTimelock {
// timestamp when token release is enabled
uint releaseTime;
- function TokenTimelock(ERC20Basic _token, address _beneficiary, uint _releaseTime) {
+ constructor(ERC20Basic _token, address _beneficiary, uint _releaseTime) {
require(_releaseTime > now);
token = _token;
beneficiary = _beneficiary;
diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp
index 33b392d4..ef84efed 100644
--- a/test/contracts/AuctionRegistrar.cpp
+++ b/test/contracts/AuctionRegistrar.cpp
@@ -123,7 +123,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
record.renewalDate = now + c_renewalInterval;
record.owner = auction.highestBidder;
Changed(_name);
- if (previousOwner != 0) {
+ if (previousOwner != 0x0000000000000000000000000000000000000000) {
if (!record.owner.send(auction.sumOfBids - auction.highestBid / 100))
throw;
} else {
@@ -143,7 +143,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
bid(_name, msg.sender, msg.value);
} else {
Record record = m_toRecord[_name];
- if (record.owner != 0)
+ if (record.owner != 0x0000000000000000000000000000000000000000)
throw;
m_toRecord[_name].owner = msg.sender;
Changed(_name);
diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp
index a3a27c37..1fd58403 100644
--- a/test/contracts/FixedFeeRegistrar.cpp
+++ b/test/contracts/FixedFeeRegistrar.cpp
@@ -76,7 +76,7 @@ contract FixedFeeRegistrar is Registrar {
function reserve(string _name) payable {
Record rec = m_record(_name);
- if (rec.owner == 0 && msg.value >= c_fee) {
+ if (rec.owner == 0x0000000000000000000000000000000000000000 && msg.value >= c_fee) {
rec.owner = msg.sender;
Changed(_name);
}
diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp
index 1031e8f1..f8ee007d 100644
--- a/test/contracts/Wallet.cpp
+++ b/test/contracts/Wallet.cpp
@@ -399,7 +399,7 @@ contract Wallet is multisig, multiowned, daylimit {
}
// determine our operation hash.
_r = keccak256(msg.data, block.number);
- if (!confirm(_r) && m_txs[_r].to == 0) {
+ if (!confirm(_r) && m_txs[_r].to == 0x0000000000000000000000000000000000000000) {
m_txs[_r].to = _to;
m_txs[_r].value = _value;
m_txs[_r].data = _data;
@@ -410,7 +410,7 @@ contract Wallet is multisig, multiowned, daylimit {
// confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order
// to determine the body of the transaction from the hash provided.
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
- if (m_txs[_h].to != 0) {
+ if (m_txs[_h].to != 0x0000000000000000000000000000000000000000) {
m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data);
MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
delete m_txs[_h];
diff --git a/test/externalTests.sh b/test/externalTests.sh
index 3125f92f..f2839083 100755
--- a/test/externalTests.sh
+++ b/test/externalTests.sh
@@ -61,6 +61,13 @@ function test_truffle
# Replace fixed-version pragmas in Gnosis (part of Consensys best practice)
find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity 0/pragma solidity ^0/'
fi
+ assertsol="node_modules/truffle/build/Assert.sol"
+ if [ -f "$assertsol" ]
+ then
+ echo "Replace Truffle's Assert.sol with a known good version"
+ rm "$assertsol"
+ wget https://raw.githubusercontent.com/trufflesuite/truffle-core/ef31bcaa15dbd9bd0f6a0070a5c63f271cde2dbc/lib/testing/Assert.sol -o "$assertsol"
+ fi
npm run test
)
rm -rf "$DIR"
diff --git a/test/libjulia/CommonSubexpression.cpp b/test/libjulia/CommonSubexpression.cpp
index 8a575c48..6c8edf1f 100644
--- a/test/libjulia/CommonSubexpression.cpp
+++ b/test/libjulia/CommonSubexpression.cpp
@@ -47,7 +47,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaCSE)
+BOOST_AUTO_TEST_SUITE(YulCSE)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/Disambiguator.cpp b/test/libjulia/Disambiguator.cpp
index ba1a06b0..48e02c7e 100644
--- a/test/libjulia/Disambiguator.cpp
+++ b/test/libjulia/Disambiguator.cpp
@@ -39,7 +39,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaDisambiguator)
+BOOST_AUTO_TEST_SUITE(YulDisambiguator)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/FunctionGrouper.cpp b/test/libjulia/FunctionGrouper.cpp
index 78f382cb..f1e83449 100644
--- a/test/libjulia/FunctionGrouper.cpp
+++ b/test/libjulia/FunctionGrouper.cpp
@@ -16,7 +16,7 @@
*/
/**
* @date 2017
- * Unit tests for the iulia function grouper.
+ * Unit tests for the Yul function grouper.
*/
#include <test/libjulia/Common.h>
@@ -43,7 +43,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaFunctionGrouper)
+BOOST_AUTO_TEST_SUITE(YulFunctionGrouper)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/FunctionHoister.cpp b/test/libjulia/FunctionHoister.cpp
index 3d6fff85..348963b4 100644
--- a/test/libjulia/FunctionHoister.cpp
+++ b/test/libjulia/FunctionHoister.cpp
@@ -16,7 +16,7 @@
*/
/**
* @date 2017
- * Unit tests for the iulia function hoister.
+ * Unit tests for the Yul function hoister.
*/
#include <test/libjulia/Common.h>
@@ -43,7 +43,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaFunctionHoister)
+BOOST_AUTO_TEST_SUITE(YulFunctionHoister)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp
index 464dcd93..2f5b7cff 100644
--- a/test/libjulia/Inliner.cpp
+++ b/test/libjulia/Inliner.cpp
@@ -16,7 +16,7 @@
*/
/**
* @date 2017
- * Unit tests for the iulia function inliner.
+ * Unit tests for the Yul function inliner.
*/
#include <test/libjulia/Common.h>
@@ -55,24 +55,24 @@ string inlinableFunctions(string const& _source)
);
}
-string inlineFunctions(string const& _source, bool _julia = true)
+string inlineFunctions(string const& _source, bool _yul = true)
{
- auto ast = disambiguate(_source, _julia);
+ auto ast = disambiguate(_source, _yul);
ExpressionInliner(ast).run();
- return assembly::AsmPrinter(_julia)(ast);
+ return assembly::AsmPrinter(_yul)(ast);
}
-string fullInline(string const& _source, bool _julia = true)
+string fullInline(string const& _source, bool _yul = true)
{
- Block ast = disambiguate(_source, _julia);
+ Block ast = disambiguate(_source, _yul);
(FunctionHoister{})(ast);
(FunctionGrouper{})(ast);\
FullInliner(ast).run();
- return assembly::AsmPrinter(_julia)(ast);
+ return assembly::AsmPrinter(_yul)(ast);
}
}
-BOOST_AUTO_TEST_SUITE(IuliaInlinableFunctionFilter)
+BOOST_AUTO_TEST_SUITE(YulInlinableFunctionFilter)
BOOST_AUTO_TEST_CASE(smoke_test)
{
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(negative)
BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE(IuliaFunctionInliner)
+BOOST_AUTO_TEST_SUITE(YulFunctionInliner)
BOOST_AUTO_TEST_CASE(simple)
{
@@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(double_recursive_calls)
BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE(IuliaFullInliner)
+BOOST_AUTO_TEST_SUITE(YulFullInliner)
BOOST_AUTO_TEST_CASE(simple)
{
diff --git a/test/libjulia/MainFunction.cpp b/test/libjulia/MainFunction.cpp
index c26b002d..e7263d13 100644
--- a/test/libjulia/MainFunction.cpp
+++ b/test/libjulia/MainFunction.cpp
@@ -16,7 +16,7 @@
*/
/**
* @date 2018
- * Unit tests for the Julia MainFunction transformation.
+ * Unit tests for the Yul MainFunction transformation.
*/
#include <test/libjulia/Common.h>
@@ -45,7 +45,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(JuliaMainFunction)
+BOOST_AUTO_TEST_SUITE(YulMainFunction)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp
index c59f91da..07154718 100644
--- a/test/libjulia/Parser.cpp
+++ b/test/libjulia/Parser.cpp
@@ -119,7 +119,7 @@ do \
BOOST_CHECK(searchErrorMessage(err, (substring))); \
} while(0)
-BOOST_AUTO_TEST_SUITE(JuliaParser)
+BOOST_AUTO_TEST_SUITE(YulParser)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/Rematerialiser.cpp b/test/libjulia/Rematerialiser.cpp
index 8f928f8e..63e525d5 100644
--- a/test/libjulia/Rematerialiser.cpp
+++ b/test/libjulia/Rematerialiser.cpp
@@ -48,7 +48,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaRematerialiser)
+BOOST_AUTO_TEST_SUITE(YulRematerialiser)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp
index 4d4e8d53..8ed8287a 100644
--- a/test/libjulia/Simplifier.cpp
+++ b/test/libjulia/Simplifier.cpp
@@ -48,7 +48,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaSimplifier)
+BOOST_AUTO_TEST_SUITE(YulSimplifier)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libjulia/UnusedPruner.cpp b/test/libjulia/UnusedPruner.cpp
index b86a54b3..649ee149 100644
--- a/test/libjulia/UnusedPruner.cpp
+++ b/test/libjulia/UnusedPruner.cpp
@@ -48,7 +48,7 @@ do\
}\
while(false)
-BOOST_AUTO_TEST_SUITE(IuliaUnusedPruner)
+BOOST_AUTO_TEST_SUITE(YulUnusedPruner)
BOOST_AUTO_TEST_CASE(smoke_test)
{
diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp
index 227eadb5..c5ece5df 100644
--- a/test/libsolidity/ABIEncoderTests.cpp
+++ b/test/libsolidity/ABIEncoderTests.cpp
@@ -279,9 +279,9 @@ BOOST_AUTO_TEST_CASE(storage_array_dyn)
address[] addr;
event E(address[] a);
function f() public {
- addr.push(1);
- addr.push(2);
- addr.push(3);
+ addr.push(0x0000000000000000000000000000000000000001);
+ addr.push(0x0000000000000000000000000000000000000002);
+ addr.push(0x0000000000000000000000000000000000000003);
E(addr);
}
}
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp
index 18c8c025..57f414db 100644
--- a/test/libsolidity/SMTChecker.cpp
+++ b/test/libsolidity/SMTChecker.cpp
@@ -433,15 +433,15 @@ BOOST_AUTO_TEST_CASE(storage_value_vars)
function f(uint x) public {
if (x == 0)
{
- a = 100;
+ a = 0x0000000000000000000000000000000000000100;
b = true;
}
else
{
- a = 200;
+ a = 0x0000000000000000000000000000000000000200;
b = false;
}
- assert(a > 0 && b);
+ assert(a > 0x0000000000000000000000000000000000000000 && b);
}
}
)";
@@ -464,19 +464,19 @@ BOOST_AUTO_TEST_CASE(storage_value_vars)
function f(uint x) public {
if (x == 0)
{
- a = 100;
+ a = 0x0000000000000000000000000000000000000100;
b = true;
}
else
{
- a = 200;
+ a = 0x0000000000000000000000000000000000000200;
b = false;
}
- assert(b == (a < 200));
+ assert(b == (a < 0x0000000000000000000000000000000000000200));
}
function g() public view {
- require(a < 100);
+ require(a < 0x0000000000000000000000000000000000000100);
assert(c >= 0);
}
address a;
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 65473f0d..42b5d417 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9460,8 +9460,8 @@ BOOST_AUTO_TEST_CASE(failing_ecrecover_invalid_input_proper)
0, // invalid v value
0x6944c77849b18048f6abe0db8084b0d0d0689cdddb53d2671c36967b58691ad4,
0xef4f06ba4f78319baafd0424365777241af4dfd3da840471b4b4b087b7750d0d,
- 0xca35b7d915458ef540ade6068dfe2f44e8fa733c,
- 0xca35b7d915458ef540ade6068dfe2f44e8fa733c
+ 0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c,
+ 0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c
);
}
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s, uint blockExpired, bytes32 salt)
diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp
index ad26ce6b..ce8f4fe4 100644
--- a/test/libsolidity/SolidityExpressionCompiler.cpp
+++ b/test/libsolidity/SolidityExpressionCompiler.cpp
@@ -490,7 +490,7 @@ BOOST_AUTO_TEST_CASE(intermediately_overflowing_literals)
// have been applied
char const* sourceCode = R"(
contract test {
- function f() { var x = (0xffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffffffffffffff01) & 0xbf; }
+ function f() { var x = (0x00ffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffffffffffffff01) & 0xbf; }
}
)";
bytes code = compileFirstExpression(sourceCode);
diff --git a/test/libsolidity/syntaxTests/deprecated_functions.sol b/test/libsolidity/syntaxTests/deprecated_functions.sol
index ff3af7d2..99ca4542 100644
--- a/test/libsolidity/syntaxTests/deprecated_functions.sol
+++ b/test/libsolidity/syntaxTests/deprecated_functions.sol
@@ -4,9 +4,9 @@ contract test {
x;
}
function g() public {
- suicide(1);
+ suicide(0x0000000000000000000000000000000000000001);
}
}
// ----
// TypeError: (58-64): "sha3" has been deprecated in favour of "keccak256"
-// TypeError: (99-109): "suicide" has been deprecated in favour of "selfdestruct"
+// TypeError: (99-150): "suicide" has been deprecated in favour of "selfdestruct"
diff --git a/test/libsolidity/syntaxTests/empty_string_var.sol b/test/libsolidity/syntaxTests/empty_string_var.sol
deleted file mode 100644
index e9837590..00000000
--- a/test/libsolidity/syntaxTests/empty_string_var.sol
+++ /dev/null
@@ -1,11 +0,0 @@
-contract C {
- function f() {
- var a = "";
- bytes1 b = bytes1(a);
- bytes memory c = bytes(a);
- string memory d = string(a);
- }
-}
-// ----
-// Warning: (34-39): Use of the "var" keyword is deprecated.
-// TypeError: (61-70): Explicit type conversion not allowed from "string memory" to "bytes1".
diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
index a6fe6c22..2481c455 100644
--- a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
@@ -3,15 +3,13 @@ contract C {
function(uint) internal returns (uint) y;
function f() public {
delete x;
- var a = y;
+ function(uint) internal returns (uint) a = y;
delete a;
delete y;
- var c = f;
+ function() internal c = f;
delete c;
function(uint) internal returns (uint) g;
delete g;
}
}
// ----
-// Warning: (157-162): Use of the "var" keyword is deprecated.
-// Warning: (212-217): Use of the "var" keyword is deprecated.
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol
deleted file mode 100644
index c8686ae8..00000000
--- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol
+++ /dev/null
@@ -1,8 +0,0 @@
-contract C {
- function f() internal returns (uint, uint, uint, uint) {
- var (uint a, uint b,,) = f();
- a; b;
- }
-}
-// ----
-// ParserError: (81-85): Expected identifier but got 'uint'
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol
deleted file mode 100644
index 4c4c62a5..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol
+++ /dev/null
@@ -1,8 +0,0 @@
-contract test {
- function f(uint256 arg1, uint32 arg2) public returns (bool ret) {
- var x = arg1 + arg2 == 8; ret = x;
- }
-}
-// ----
-// Warning: (94-99): Use of the "var" keyword is deprecated.
-// Warning: (20-134): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol
deleted file mode 100644
index 70d31f25..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol
+++ /dev/null
@@ -1,6 +0,0 @@
-contract test {
- function f() public returns (int256 r) { var x = int256(uint32(2)); return x; }
-}
-// ----
-// Warning: (61-66): Use of the "var" keyword is deprecated.
-// Warning: (20-99): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol
index 18ff6054..7f858a4d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol
@@ -1,7 +1,6 @@
contract test {
- function f() public { var x = "123456789012345678901234567890123"; }
+ function f() public { string memory x = "123456789012345678901234567890123"; }
}
// ----
-// Warning: (42-47): Use of the "var" keyword is deprecated.
-// Warning: (42-47): Unused local variable.
-// Warning: (20-88): Function state mutability can be restricted to pure
+// Warning: (42-57): Unused local variable.
+// Warning: (20-98): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol
index 764f630f..8bf45c3f 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol
@@ -4,10 +4,9 @@ contract test {
}
str data;
function fun() public {
- var a = data.map;
+ mapping(uint=>uint) a = data.map;
data.map = a;
}
}
// ----
-// Warning: (122-127): Use of the "var" keyword is deprecated.
-// TypeError: (148-160): Mappings cannot be assigned to.
+// TypeError: (164-176): Mappings cannot be assigned to.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol
index f7db0b24..6fbd09ae 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol
@@ -4,9 +4,8 @@ contract test {
}
str data;
function fun() public {
- var a = data;
+ str storage a = data;
data = a;
}
}
// ----
-// Warning: (122-127): Use of the "var" keyword is deprecated.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol
index 78d89ef8..27651d63 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol
@@ -1,10 +1,9 @@
contract C {
mapping(uint => uint) x;
function f() public returns (bool ret) {
- var y = x;
+ mapping(uint => uint) y = x;
return x == y;
}
}
// ----
-// Warning: (95-100): Use of the "var" keyword is deprecated.
-// TypeError: (121-127): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256)
+// TypeError: (139-145): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256)
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol
deleted file mode 100644
index b79b976a..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract c {
- function f() public { var (x) = f(); }
-}
-// ----
-// Warning: (44-45): Use of the "var" keyword is deprecated.
-// Warning: (39-52): Different number of components on the left hand side (1) than on the right hand side (0).
-// TypeError: (39-52): Not enough components (0) in value to assign all variables (1).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol
deleted file mode 100644
index db086252..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol
+++ /dev/null
@@ -1,9 +0,0 @@
-contract test {
- function f() pure public returns (uint) {
- var i = 1;
- return i;
- }
-}
-// ----
-// Warning: (70-75): Use of the "var" keyword is deprecated.
-// Warning: (70-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol
deleted file mode 100644
index 2b48ce5d..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol
+++ /dev/null
@@ -1,9 +0,0 @@
-contract test {
- function f() pure public {
- var i = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
- i;
- }
-}
-// ----
-// Warning: (55-60): Use of the "var" keyword is deprecated.
-// Warning: (55-129): The type of this variable was inferred as uint256, which can hold values between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935. This is probably not desired. Use an explicit type to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol
deleted file mode 100644
index bebcbab5..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol
+++ /dev/null
@@ -1,9 +0,0 @@
-contract test {
- function f() pure public {
- var i = -2;
- i;
- }
-}
-// ----
-// Warning: (55-60): Use of the "var" keyword is deprecated.
-// Warning: (55-65): The type of this variable was inferred as int8, which can hold values between -128 and 127. This is probably not desired. Use an explicit type to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol
deleted file mode 100644
index 3d269993..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol
+++ /dev/null
@@ -1,8 +0,0 @@
- contract test {
- function f() pure public {
- for (var i = 0; i < msg.data.length; i++) { }
- }
- }
-// ----
-// Warning: (63-68): Use of the "var" keyword is deprecated.
-// Warning: (63-72): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol
index f7daa33f..07fc1c43 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol
@@ -1,7 +1,6 @@
contract test {
function f(uint a) public returns (uint) { return 2 * a; }
- function g() public returns (uint) { var x = f; return x(7); }
+ function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); }
}
// ----
-// Warning: (120-125): Use of the "var" keyword is deprecated.
// Warning: (20-78): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol
index 375980c3..9ed864f1 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol
@@ -1,8 +1,7 @@
contract test {
function f() public returns (uint) { return 1; }
function f(uint a) public returns (uint) { return 2 * a; }
- function g() public returns (uint) { var x = f; return x(7); }
+ function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); }
}
// ----
-// Warning: (173-178): Use of the "var" keyword is deprecated.
-// TypeError: (181-182): No matching declaration found after variable lookup.
+// TypeError: (208-209): No matching declaration found after variable lookup.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol
deleted file mode 100644
index 61836b59..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol
+++ /dev/null
@@ -1,6 +0,0 @@
-contract C {
- function f() public returns (uint) { var x; return 2; }
-}
-// ----
-// Warning: (54-59): Use of the "var" keyword is deprecated.
-// TypeError: (54-59): Assignment necessary for type detection.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol
index 8e838537..9d51e06b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol
@@ -1,7 +1,6 @@
contract C {
string s;
- function f() public { var a = s[2]; }
+ function f() public { bytes1 a = s[2]; }
}
// ----
-// Warning: (53-58): Use of the "var" keyword is deprecated.
-// TypeError: (61-65): Index access for string is not possible.
+// TypeError: (64-68): Index access for string is not possible.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol
index 36be82c9..9e714d68 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol
@@ -1,7 +1,6 @@
contract C {
string s;
- function f() public { var a = s.length; }
+ function f() public { uint a = s.length; }
}
// ----
-// Warning: (53-58): Use of the "var" keyword is deprecated.
-// TypeError: (61-69): Member "length" not found or not visible after argument-dependent lookup in string storage ref
+// TypeError: (62-70): Member "length" not found or not visible after argument-dependent lookup in string storage ref
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol
index a2048a8a..febe39e6 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol
@@ -1,10 +1,9 @@
contract C {
uint[] data;
function f(uint[] x) public {
- var dataRef = data;
+ uint[] storage dataRef = data;
dataRef = x;
}
}
// ----
-// Warning: (72-83): Use of the "var" keyword is deprecated.
-// TypeError: (110-111): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer.
+// TypeError: (121-122): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol
index d17b62e4..7a6fb1c7 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol
@@ -1,10 +1,9 @@
contract C {
uint[] data;
function f() public {
- var x = data;
+ uint[] storage x = data;
delete x;
}
}
// ----
-// Warning: (64-69): Use of the "var" keyword is deprecated.
-// TypeError: (86-94): Unary operator delete cannot be applied to type uint256[] storage pointer
+// TypeError: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol
index 8dbaef9c..8624b0b0 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol
@@ -1,6 +1,5 @@
contract Test {
- function f() public { var x = new Test(); }
+ function f() public { Test x = new Test(); }
}
// ----
-// Warning: (42-47): Use of the "var" keyword is deprecated.
-// TypeError: (50-58): Circular reference for contract creation (cannot create instance of derived or same contract).
+// TypeError: (51-59): Circular reference for contract creation (cannot create instance of derived or same contract).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol
deleted file mode 100644
index de115d12..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol
+++ /dev/null
@@ -1,5 +0,0 @@
-contract C { function f() public { var (x,y); x = 1; y = 1;} }
-// ----
-// Warning: (40-41): Use of the "var" keyword is deprecated.
-// Warning: (42-43): Use of the "var" keyword is deprecated.
-// TypeError: (35-44): Assignment necessary for type detection.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
index a1cfb070..ae260ce4 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
@@ -3,24 +3,18 @@ contract C {
function two() public returns (uint, uint);
function none();
function f() public {
- var (a,) = three();
- var (b,c,) = two();
- var (,d) = three();
- var (,e,g) = two();
+ (uint a,) = three();
+ (uint b, uint c,) = two();
+ (,uint d) = three();
+ (,uint e, uint g) = two();
var (,,) = three();
var () = none();
a;b;c;d;e;g;
}
}
// ----
-// Warning: (177-178): Use of the "var" keyword is deprecated.
-// Warning: (205-206): Use of the "var" keyword is deprecated.
-// Warning: (207-208): Use of the "var" keyword is deprecated.
-// Warning: (234-235): Use of the "var" keyword is deprecated.
-// Warning: (262-263): Use of the "var" keyword is deprecated.
-// Warning: (264-265): Use of the "var" keyword is deprecated.
-// Warning: (172-190): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (200-218): Different number of components on the left hand side (3) than on the right hand side (2).
-// Warning: (228-246): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (256-274): Different number of components on the left hand side (3) than on the right hand side (2).
+// Warning: (172-191): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (201-226): Different number of components on the left hand side (3) than on the right hand side (2).
+// Warning: (236-255): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (265-290): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (121-137): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol
index 526ff4e8..0ccbb327 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol
@@ -1,9 +1,7 @@
contract C {
function one() public returns (uint);
- function f() public { var (a, b, ) = one(); }
+ function f() public { (uint a, uint b, ) = one(); }
}
// ----
-// Warning: (86-87): Use of the "var" keyword is deprecated.
-// Warning: (89-90): Use of the "var" keyword is deprecated.
-// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
+// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol
index e41edb64..8d5de125 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol
@@ -1,8 +1,7 @@
contract C {
function one() public returns (uint);
- function f() public { var (a, , ) = one(); }
+ function f() public { (uint a, , ) = one(); }
}
// ----
-// Warning: (86-87): Use of the "var" keyword is deprecated.
-// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-100): Not enough components (1) in value to assign all variables (2).
+// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol
index 202b79c6..993df9b9 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol
@@ -1,8 +1,7 @@
contract C {
function one() public returns (uint);
- function f() public { var (, , a) = one(); }
+ function f() public { (, , uint a) = one(); }
}
// ----
-// Warning: (90-91): Use of the "var" keyword is deprecated.
-// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-100): Not enough components (1) in value to assign all variables (2).
+// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol
index 79f2f3b5..0697b789 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol
@@ -1,9 +1,7 @@
contract C {
function one() public returns (uint);
- function f() public { var (, a, b) = one(); }
+ function f() public { (, uint a, uint b) = one(); }
}
// ----
-// Warning: (88-89): Use of the "var" keyword is deprecated.
-// Warning: (91-92): Use of the "var" keyword is deprecated.
-// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
+// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
index 43553af9..3112f67a 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
@@ -1,17 +1,13 @@
contract C {
function f() public {
uint a = (1);
- var (b,) = (uint8(1),);
- var (c,d) = (uint32(1), 2 + a);
- var (e,) = (uint64(1), 2, b);
+ (uint b,) = (uint8(1),);
+ (uint c, uint d) = (uint32(1), 2 + a);
+ (uint e,) = (uint64(1), 2, b);
a;b;c;d;e;
}
}
// ----
-// Warning: (74-75): Use of the "var" keyword is deprecated.
-// Warning: (106-107): Use of the "var" keyword is deprecated.
-// Warning: (108-109): Use of the "var" keyword is deprecated.
-// Warning: (146-147): Use of the "var" keyword is deprecated.
-// Warning: (69-91): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (141-169): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (17-195): Function state mutability can be restricted to pure
+// Warning: (69-92): Different number of components on the left hand side (2) than on the right hand side (1).
+// Warning: (149-178): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (17-204): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol
index 734ba09c..cc5953db 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol
@@ -1,10 +1,7 @@
contract C {
function two() public returns (uint, uint);
- function f() public { var (a, b, c) = two(); }
+ function f() public { (uint a, uint b, uint c) = two(); }
}
// ----
-// Warning: (92-93): Use of the "var" keyword is deprecated.
-// Warning: (95-96): Use of the "var" keyword is deprecated.
-// Warning: (98-99): Use of the "var" keyword is deprecated.
-// Warning: (87-108): Different number of components on the left hand side (3) than on the right hand side (2).
-// TypeError: (87-108): Not enough components (2) in value to assign all variables (3).
+// Warning: (87-119): Different number of components on the left hand side (3) than on the right hand side (2).
+// TypeError: (87-119): Not enough components (2) in value to assign all variables (3).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol
deleted file mode 100644
index f3e02ecb..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol
+++ /dev/null
@@ -1,11 +0,0 @@
-contract C {
- function f() public { }
- function g() public {
- var (x,) = (f(), f());
- }
-}
-// ----
-// Warning: (80-81): Use of the "var" keyword is deprecated.
-// Warning: (87-90): Tuple component cannot be empty.
-// Warning: (92-95): Tuple component cannot be empty.
-// TypeError: (80-81): Cannot declare variable with void (empty tuple) type.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol
index 09e357e6..c3cc5232 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol
@@ -3,9 +3,11 @@ contract C {
using D for D.s;
D.s x;
function f(uint a) public returns (uint) {
- var g = x.mul;
- return g({x: a});
+ function (D.s storage, uint) returns (uint) g = x.mul;
+ g(x, a);
+ g(a);
}
}
// ----
-// Warning: (218-223): Use of the "var" keyword is deprecated.
+// TypeError: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256).
+// TypeError: (298-302): Wrong argument count for function call: 1 arguments given but expected 2.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol
index acb5a0b5..71f43992 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol
@@ -5,12 +5,10 @@ library L {
contract C {
function f(uint size) public {
L.S[][] memory x = new L.S[][](10);
- var y = new uint[](20);
- var z = new bytes(size);
+ uint[] memory y = new uint[](20);
+ bytes memory z = new bytes(size);
x;y;z;
}
}
// ----
-// Warning: (205-210): Use of the "var" keyword is deprecated.
-// Warning: (237-242): Use of the "var" keyword is deprecated.
-// Warning: (122-282): Function state mutability can be restricted to pure
+// Warning: (122-301): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol
index 8ad26fc0..f0bb557b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol
@@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
- var x = new mapping(uint => uint)[](4);
+ mapping(uint => uint) x = new mapping(uint => uint)[](4);
}
}
// ----
-// Warning: (56-61): Use of the "var" keyword is deprecated.
-// TypeError: (68-91): Type cannot live outside storage.
+// TypeError: (86-109): Type cannot live outside storage.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol
index 1dd81fde..c4b2c692 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol
@@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
- var x = new uint(7);
+ uint x = new uint(7);
}
}
// ----
-// Warning: (56-61): Use of the "var" keyword is deprecated.
-// TypeError: (64-72): Contract or array type expected.
+// TypeError: (65-73): Contract or array type expected.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol
index ea3556de..078255e3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol
@@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
- var x = new uint[]();
+ uint[] memory x = new uint[]();
}
}
// ----
-// Warning: (56-61): Use of the "var" keyword is deprecated.
-// TypeError: (64-76): Wrong argument count for function call: 0 arguments given but expected 1.
+// TypeError: (74-86): Wrong argument count for function call: 0 arguments given but expected 1.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol
index 9a169468..35671e6f 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol
@@ -2,9 +2,8 @@ contract C {
struct S { uint a; uint b; }
function f() public {
- var s = S({a: 1});
+ S memory s = S({a: 1});
}
}
// ----
-// Warning: (81-86): Use of the "var" keyword is deprecated.
-// TypeError: (89-98): Wrong argument count for struct constructor: 1 arguments given but expected 2.
+// TypeError: (94-103): Wrong argument count for struct constructor: 1 arguments given but expected 2.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol
index 4075f6f3..41e72d60 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol
@@ -25,7 +25,7 @@ contract C {
h += 1; // Avoid unused var warning
// string literal
- var i = true ? "hello" : "world";
+ string memory i = true ? "hello" : "world";
i = "used"; //Avoid unused var warning
}
function f2() public {
@@ -38,18 +38,18 @@ contract C {
// array
byte[2] memory a;
byte[2] memory b;
- var k = true ? a : b;
+ byte[2] memory k = true ? a : b;
k[0] = byte(0); //Avoid unused var warning
bytes memory e;
bytes memory f;
- var l = true ? e : f;
+ bytes memory l = true ? e : f;
l[0] = byte(0); // Avoid unused var warning
// fixed bytes
bytes2 c;
bytes2 d;
- var m = true ? c : d;
+ bytes2 m = true ? c : d;
m &= m;
}
@@ -60,7 +60,7 @@ contract C {
struct_x = true ? struct_x : struct_y;
// function
- var r = true ? fun_x : fun_y;
+ function () r = true ? fun_x : fun_y;
r(); // Avoid unused var warning
// enum
small enum_x;
@@ -68,13 +68,13 @@ contract C {
enum_x = true ? enum_x : enum_y;
// tuple
- var (n, o) = true ? (1, 2) : (3, 4);
+ (uint n, uint o) = true ? (1, 2) : (3, 4);
(n, o) = (o, n); // Avoid unused var warning
// mapping
- var p = true ? table1 : table2;
+ mapping(uint8 => uint8) p = true ? table1 : table2;
p[0] = 0; // Avoid unused var warning
// typetype
- var q = true ? uint32(1) : uint32(2);
+ uint32 q = true ? uint32(1) : uint32(2);
q += 1; // Avoid unused var warning
// modifier doesn't fit in here
@@ -84,17 +84,8 @@ contract C {
}
}
// ----
-// Warning: (546-551): Use of the "var" keyword is deprecated.
-// Warning: (878-883): Use of the "var" keyword is deprecated.
-// Warning: (1008-1013): Use of the "var" keyword is deprecated.
-// Warning: (1150-1155): Use of the "var" keyword is deprecated.
-// Warning: (1357-1362): Use of the "var" keyword is deprecated.
-// Warning: (1560-1561): Use of the "var" keyword is deprecated.
-// Warning: (1563-1564): Use of the "var" keyword is deprecated.
-// Warning: (1672-1677): Use of the "var" keyword is deprecated.
-// Warning: (1778-1783): Use of the "var" keyword is deprecated.
-// Warning: (984-998): This declaration shadows an existing declaration.
+// Warning: (1005-1019): This declaration shadows an existing declaration.
// Warning: (90-116): Function state mutability can be restricted to pure
// Warning: (121-147): Function state mutability can be restricted to pure
-// Warning: (257-632): Function state mutability can be restricted to pure
-// Warning: (637-1194): Function state mutability can be restricted to pure
+// Warning: (257-642): Function state mutability can be restricted to pure
+// Warning: (647-1227): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol
index cfaba794..0fd5f331 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol
@@ -1,9 +1,7 @@
contract test {
function f() public {
- var a = 3 ** ufixed(1.5);
+ ufixed a = 3 ** ufixed(1.5);
}
}
// ----
-// Warning: (50-55): Use of the "var" keyword is deprecated.
-// TypeError: (58-74): Operator ** not compatible with types int_const 3 and ufixed128x18
-// Warning: (50-74): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
+// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol
index 7d2716fd..03d10f7c 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol
@@ -1,9 +1,7 @@
contract test {
function f() public {
- var c = 42 ** fixed(-1/4);
+ ufixed c = 42 ** fixed(-1/4);
}
}
// ----
-// Warning: (50-55): Use of the "var" keyword is deprecated.
-// TypeError: (58-75): Operator ** not compatible with types int_const 42 and fixed128x18
-// Warning: (50-75): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
+// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol
deleted file mode 100644
index dac35a54..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol
+++ /dev/null
@@ -1,16 +0,0 @@
-contract test {
- function f() public {
- var a = 0.12345678;
- var b = 12345678.352;
- var c = 0.00000009;
- a; b; c;
- }
-}
-// ----
-// Warning: (50-55): Use of the "var" keyword is deprecated.
-// Warning: (78-83): Use of the "var" keyword is deprecated.
-// Warning: (108-113): Use of the "var" keyword is deprecated.
-// Warning: (50-68): The type of this variable was inferred as ufixed24x8. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (78-98): The type of this variable was inferred as ufixed40x3. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (108-126): The type of this variable was inferred as ufixed8x8. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (20-150): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol
deleted file mode 100644
index 2f781a5d..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol
+++ /dev/null
@@ -1,12 +0,0 @@
-contract test {
- function f() public {
- var (a, b) = (.5, 1/3);
- a; b;
- }
-}
-// ----
-// Warning: (55-56): Use of the "var" keyword is deprecated.
-// Warning: (58-59): Use of the "var" keyword is deprecated.
-// Warning: (50-72): The type of this variable was inferred as ufixed8x1. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (50-72): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (20-93): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol
deleted file mode 100644
index ef2b912c..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol
+++ /dev/null
@@ -1,10 +0,0 @@
-contract test {
- function f() public {
- var x = 1/3;
- }
-}
-// ----
-// Warning: (50-55): Use of the "var" keyword is deprecated.
-// Warning: (50-61): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (50-55): Unused local variable.
-// Warning: (20-68): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol
index 221d513e..81cc7d0d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol
@@ -1,9 +1,6 @@
contract C {
function f() public {
- var x = 0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E;
- x.send(2);
+ (0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E).transfer(2);
}
}
// ----
-// Warning: (47-52): Use of the "var" keyword is deprecated.
-// Warning: (107-116): Failure condition of 'send' ignored. Consider using 'transfer' instead.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol
index 8084e0d1..fe4691c2 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
-// Warning: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
+// SyntaxError: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol
index 51521fe6..6f4ac730 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
-// Warning: (64-106): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
+// SyntaxError: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol
index 4dd93c63..da5dc380 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
-// Warning: (64-105): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0x0A0BfC97E48458494ccD857e1A85Dc91f7f0046e'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
+// SyntaxError: (64-105): This looks like an address but is not exactly 40 hex digits. It is 39 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol
index 37c6aa05..749612c9 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol
@@ -5,5 +5,4 @@ contract C {
}
}
// ----
-// Warning: (64-107): This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
-// TypeError: (52-107): Type int_const 2284...(42 digits omitted)...9360 is not implicitly convertible to expected type address.
+// SyntaxError: (64-107): This looks like an address but is not exactly 40 hex digits. It is 41 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol
index 2b96a7ee..5f601db2 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol
@@ -1,10 +1,8 @@
contract C {
function h() pure external {
}
- function f() view external returns (bytes4) {
- var g = this.h;
- return g.selector;
+ function f() pure external returns (bytes4) {
+ return this.h.selector;
}
}
// ----
-// Warning: (110-115): Use of the "var" keyword is deprecated.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol
index ed6c01c5..9ee7d9bb 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol
@@ -3,9 +3,7 @@ contract C {
}
function f() view external returns (bytes4) {
function () pure external g = this.h;
- var i = g;
- return i.selector;
+ return g.selector;
}
}
// ----
-// Warning: (156-161): Use of the "var" keyword is deprecated.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
index 4f185e4d..35f4639e 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
@@ -9,14 +9,13 @@ contract C {
}
contract D {
function f() {
- var x = (new C()).balance();
+ uint x = (new C()).balance();
x;
(new C()).transfer(5);
}
}
// ----
-// Warning: (282-287): Use of the "var" keyword is deprecated.
// Warning: (17-127): No visibility specified. Defaulting to "public".
// Warning: (132-239): No visibility specified. Defaulting to "public".
-// Warning: (259-358): No visibility specified. Defaulting to "public".
+// Warning: (259-359): No visibility specified. Defaulting to "public".
// Warning: (17-127): Function state mutability can be restricted to view
diff --git a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
index 727e6115..37763697 100644
--- a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
+++ b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
@@ -1,8 +1,8 @@
contract test {
- function fun(uint256 a) returns (address b) {
+ function fun(uint256 a) returns (uint8 b) {
if (a < 0) b = 0x67; else if (a == 0) b = 0x12; else b = 0x78;
}
}
// ----
-// Warning: (20-142): No visibility specified. Defaulting to "public".
-// Warning: (20-142): Function state mutability can be restricted to pure
+// Warning: (20-140): No visibility specified. Defaulting to "public".
+// Warning: (20-140): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/if_statement.sol b/test/libsolidity/syntaxTests/parsing/if_statement.sol
index 0819cb9f..451fba1f 100644
--- a/test/libsolidity/syntaxTests/parsing/if_statement.sol
+++ b/test/libsolidity/syntaxTests/parsing/if_statement.sol
@@ -1,11 +1,9 @@
contract test {
function fun(uint256 a) returns (uint) {
- if (a >= 8) { return 2; } else { var b = 7; }
+ if (a >= 8) { return 2; } else { uint b = 7; }
}
}
// ----
-// Warning: (102-107): Use of the "var" keyword is deprecated.
-// Warning: (102-111): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (20-120): No visibility specified. Defaulting to "public".
-// Warning: (102-107): Unused local variable.
-// Warning: (20-120): Function state mutability can be restricted to pure
+// Warning: (20-121): No visibility specified. Defaulting to "public".
+// Warning: (102-108): Unused local variable.
+// Warning: (20-121): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/modifier.sol b/test/libsolidity/syntaxTests/parsing/modifier.sol
index 3e659dcf..b995ce89 100644
--- a/test/libsolidity/syntaxTests/parsing/modifier.sol
+++ b/test/libsolidity/syntaxTests/parsing/modifier.sol
@@ -1,3 +1,3 @@
contract c {
- modifier mod { if (msg.sender == 0) _; }
+ modifier mod { if (msg.sender == 0x0000000000000000000000000000000000000000) _; }
}
diff --git a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
index 818999df..1984ed36 100644
--- a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
+++ b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
@@ -1,29 +1,15 @@
contract C {
- function f() {
- var (a,b,c) = g();
- var (d) = 2;
- var (,e) = 3;
- var (f,) = 4;
- var (x,,) = g();
- var (,y,) = g();
- var () = g();
- var (,,) = g();
+ function f() pure public {
+ (uint a, uint b, uint c) = g();
+ (uint d) = 2;
+ (, uint e) = 3;
+ (uint h,) = 4;
+ (uint x,,) = g();
+ (, uint y,) = g();
+ a; b; c; d; e; h; x; y;
}
- function g() returns (uint, uint, uint) {}
+ function g() pure public returns (uint, uint, uint) {}
}
// ----
-// Warning: (36-37): Use of the "var" keyword is deprecated.
-// Warning: (38-39): Use of the "var" keyword is deprecated.
-// Warning: (40-41): Use of the "var" keyword is deprecated.
-// Warning: (57-58): Use of the "var" keyword is deprecated.
-// Warning: (73-74): Use of the "var" keyword is deprecated.
-// Warning: (88-89): Use of the "var" keyword is deprecated.
-// Warning: (104-105): Use of the "var" keyword is deprecated.
-// Warning: (124-125): Use of the "var" keyword is deprecated.
-// Warning: (88-89): This declaration shadows an existing declaration.
-// Warning: (52-63): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (67-79): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (67-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (83-95): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (83-95): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// TypeError: (137-149): Too many components (3) in value for variable assignment (0) needed
+// Warning: (93-107): Different number of components on the left hand side (2) than on the right hand side (1).
+// Warning: (111-124): Different number of components on the left hand side (2) than on the right hand side (1).
diff --git a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
index 72546dc0..e331440d 100644
--- a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
+++ b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
@@ -1,11 +1,9 @@
contract c {
function fun() returns (uint r) {
- var _ = 8;
+ uint _ = 8;
return _ + 1;
}
}
// ----
-// Warning: (59-64): Use of the "var" keyword is deprecated.
-// Warning: (59-68): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (17-97): No visibility specified. Defaulting to "public".
-// Warning: (17-97): Function state mutability can be restricted to pure
+// Warning: (17-98): No visibility specified. Defaulting to "public".
+// Warning: (17-98): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol
index 6f739740..d691da44 100644
--- a/test/libsolidity/syntaxTests/parsing/tuples.sol
+++ b/test/libsolidity/syntaxTests/parsing/tuples.sol
@@ -1,24 +1,17 @@
contract C {
function f() {
uint a = (1);
- var (b,) = (1,);
- var (c,d) = (1, 2 + a);
- var (e,) = (1, 2, b);
+ (uint b,) = (1,);
+ (uint c, uint d) = (1, 2 + a);
+ (uint e,) = (1, 2, b);
(a) = 3;
}
}
// ----
-// Warning: (52-53): Use of the "var" keyword is deprecated.
-// Warning: (71-72): Use of the "var" keyword is deprecated.
-// Warning: (73-74): Use of the "var" keyword is deprecated.
-// Warning: (97-98): Use of the "var" keyword is deprecated.
-// Warning: (47-62): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (47-62): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (66-88): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (92-112): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (92-112): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
-// Warning: (14-127): No visibility specified. Defaulting to "public".
-// Warning: (71-72): Unused local variable.
-// Warning: (73-74): Unused local variable.
-// Warning: (97-98): Unused local variable.
-// Warning: (14-127): Function state mutability can be restricted to pure
+// Warning: (47-63): Different number of components on the left hand side (2) than on the right hand side (1).
+// Warning: (100-121): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (14-136): No visibility specified. Defaulting to "public".
+// Warning: (68-74): Unused local variable.
+// Warning: (76-82): Unused local variable.
+// Warning: (101-107): Unused local variable.
+// Warning: (14-136): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol b/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol
index 1d243c7c..23484567 100644
--- a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol
+++ b/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol
@@ -1,11 +1,8 @@
contract C {
function f() public pure returns (uint, uint, uint, uint) {
- // Can later be replaced by (uint a, uint b,) = f();
- var (a,b,) = f();
+ (uint a, uint b,) = f();
a; b;
}
}
// ----
-// Warning: (136-137): Use of the "var" keyword is deprecated.
-// Warning: (138-139): Use of the "var" keyword is deprecated.
-// Warning: (131-147): Different number of components on the left hand side (3) than on the right hand side (4).
+// Warning: (76-99): Different number of components on the left hand side (3) than on the right hand side (4).