aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md7
-rw-r--r--docs/contracts.rst14
-rw-r--r--docs/solidity-by-example.rst9
-rw-r--r--libsolidity/analysis/TypeChecker.cpp123
-rw-r--r--libsolidity/analysis/TypeChecker.h7
-rw-r--r--libsolidity/ast/AST.h11
-rw-r--r--libsolidity/ast/ASTAnnotations.h3
-rw-r--r--libsolidity/ast/ASTJsonConverter.cpp4
-rw-r--r--libsolidity/ast/AST_accept.h6
-rw-r--r--libsolidity/ast/Types.cpp6
-rw-r--r--libsolidity/ast/Types.h12
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp46
-rw-r--r--libsolidity/codegen/ContractCompiler.h2
-rw-r--r--libsolidity/interface/CompilerStack.cpp143
-rw-r--r--libsolidity/interface/ErrorReporter.cpp37
-rw-r--r--libsolidity/interface/ErrorReporter.h9
-rw-r--r--libsolidity/parsing/Parser.cpp6
-rw-r--r--test/libsolidity/FormattedScope.h2
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp8
-rw-r--r--test/libsolidity/SyntaxTest.cpp88
-rw-r--r--test/libsolidity/SyntaxTest.h7
-rw-r--r--test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol2
-rw-r--r--test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol6
-rw-r--r--test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol8
-rw-r--r--test/libsolidity/syntaxTests/double_stateVariable_declaration.sol2
-rw-r--r--test/libsolidity/syntaxTests/double_variable_declaration.sol2
-rw-r--r--test/libsolidity/syntaxTests/double_variable_declaration_050.sol6
-rw-r--r--test/libsolidity/syntaxTests/empty_struct.sol2
-rw-r--r--test/libsolidity/syntaxTests/empty_struct_050.sol2
-rw-r--r--test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol2
-rw-r--r--test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol2
-rw-r--r--test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol2
-rw-r--r--test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol9
-rw-r--r--test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol4
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol5
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol7
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol4
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol6
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol7
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol6
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol6
-rw-r--r--test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol4
-rw-r--r--test/libsolidity/syntaxTests/literal_comparisons.sol7
-rw-r--r--test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol524
-rw-r--r--test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol524
-rw-r--r--test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_function_declaration.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol4
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol4
-rw-r--r--test/libsolidity/syntaxTests/scoping/name_shadowing.sol3
-rw-r--r--test/libsolidity/syntaxTests/scoping/scoping.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/scoping_activation.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/scoping_for3.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol2
-rw-r--r--test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol2
-rw-r--r--test/libsolidity/syntaxTests/smoke_test.sol2
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol8
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol10
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol6
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol12
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol2
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol2
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_default.sol4
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_default050.sol4
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_internal.sol2
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_private.sol2
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_public.sol2
-rw-r--r--test/libsolidity/syntaxTests/visibility/interface/function_public050.sol2
-rw-r--r--test/tools/isoltest.cpp71
76 files changed, 1603 insertions, 264 deletions
diff --git a/Changelog.md b/Changelog.md
index 1ed2f1dd..6df11f27 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,15 +4,19 @@ Features:
* Code Generator: Initialize arrays without using ``msize()``.
* Code Generator: More specialized and thus optimized implementation for ``x.push(...)``
* Commandline interface: Error when missing or inaccessible file detected. Suppress it with the ``--ignore-missing`` flag.
+ * General: Limit the number of errors output in a single run to 256.
* General: Support accessing dynamic return data in post-byzantium EVMs.
* Interfaces: Allow overriding external functions in interfaces with public in an implementing contract.
* Optimizer: Optimize ``SHL`` and ``SHR`` only involving constants (Constantinople only).
* Optimizer: Remove useless ``SWAP1`` instruction preceding a commutative instruction (such as ``ADD``, ``MUL``, etc).
* Optimizer: Replace comparison operators (``LT``, ``GT``, etc) with opposites if preceded by ``SWAP1``, e.g. ``SWAP1 LT`` is replaced with ``GT``.
* Optimizer: Optimize across ``mload`` if ``msize()`` is not used.
+ * Static Analyzer: Error on duplicated super constructor calls as experimental 0.5.0 feature.
* Syntax Checker: Issue warning for empty structs (or error as experimental 0.5.0 feature).
+ * Syntax Tests: Add source locations to syntax test expectations.
* General: Introduce new constructor syntax using the ``constructor`` keyword as experimental 0.5.0 feature.
- * Inheritance: Error when using empty parenthesis for base class constructors that require arguments as experimental 0.5.0 feature.
+ * Inheritance: Error when using empty parentheses for base class constructors that require arguments as experimental 0.5.0 feature.
+ * Inheritance: Error when using no parentheses in modifier-style constructor calls as experimental 0.5.0 feature.
Bugfixes:
* Code Generator: Allow ``block.blockhash`` without being called.
@@ -25,6 +29,7 @@ Bugfixes:
* DocString Parser: Fix error message for empty descriptions.
* Standard JSON: Support ``constantinople`` as ``evmVersion`` properly.
* Type Checker: Fix detection of recursive structs.
+ * Type Checker: Fix asymmetry bug when comparing with literal numbers.
* Type System: Improve error message when attempting to shift by a fractional amount.
* Type System: Make external library functions accessible.
* Type System: Prevent encoding of weird types.
diff --git a/docs/contracts.rst b/docs/contracts.rst
index f8a44fb3..0dd9845c 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -1034,9 +1034,12 @@ the base constructors. This can be done in two ways::
constructor(uint _x) public { x = _x; }
}
- contract Derived is Base(7) {
- constructor(uint _y) Base(_y * _y) public {
- }
+ contract Derived1 is Base(7) {
+ constructor(uint _y) public {}
+ }
+
+ contract Derived2 is Base {
+ constructor(uint _y) Base(_y * _y) public {}
}
One way is directly in the inheritance list (``is Base(7)``). The other is in
@@ -1046,8 +1049,9 @@ do it is more convenient if the constructor argument is a
constant and defines the behaviour of the contract or
describes it. The second way has to be used if the
constructor arguments of the base depend on those of the
-derived contract. If, as in this silly example, both places
-are used, the modifier-style argument takes precedence.
+derived contract. Arguments have to be given either in the
+inheritance list or in modifier-style in the derived constuctor.
+Specifying arguments in both places is an error.
.. index:: ! inheritance;multiple, ! linearization, ! C3 linearization
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 27fefd49..3636a332 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -89,11 +89,10 @@ of votes.
function giveRightToVote(address voter) public {
// If the argument of `require` evaluates to `false`,
// it terminates and reverts all changes to
- // the state and to Ether balances. It is often
- // a good idea to use this if functions are
- // called incorrectly. But watch out, this
- // will currently also consume all provided gas
- // (this is planned to change in the future).
+ // the state and to Ether balances.
+ // This consumes all gas in old EVM versions, but not anymore.
+ // It is often a good idea to use this if functions are
+ // called incorrectly.
require(
(msg.sender == chairperson) &&
!voters[voter].voted &&
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index a252742d..8b57fc15 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -60,17 +60,7 @@ bool typeSupportedByOldABIEncoder(Type const& _type)
bool TypeChecker::checkTypeRequirements(ASTNode const& _contract)
{
- try
- {
- _contract.accept(*this);
- }
- catch (FatalError const&)
- {
- // We got a fatal error which required to stop further type checking, but we can
- // continue normally from here.
- if (m_errorReporter.errors().empty())
- throw; // Something is weird here, rather throw again.
- }
+ _contract.accept(*this);
return Error::containsOnlyWarnings(m_errorReporter.errors());
}
@@ -101,7 +91,7 @@ bool TypeChecker::visit(ContractDefinition const& _contract)
checkContractDuplicateEvents(_contract);
checkContractIllegalOverrides(_contract);
checkContractAbstractFunctions(_contract);
- checkContractAbstractConstructors(_contract);
+ checkContractBaseConstructorArguments(_contract);
FunctionDefinition const* function = _contract.constructor();
if (function)
@@ -291,42 +281,108 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont
}
}
-void TypeChecker::checkContractAbstractConstructors(ContractDefinition const& _contract)
+void TypeChecker::checkContractBaseConstructorArguments(ContractDefinition const& _contract)
{
- set<ContractDefinition const*> argumentsNeeded;
- // check that we get arguments for all base constructors that need it.
- // If not mark the contract as abstract (not fully implemented)
+ bool const v050 = _contract.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
vector<ContractDefinition const*> const& bases = _contract.annotation().linearizedBaseContracts;
- for (ContractDefinition const* contract: bases)
- if (FunctionDefinition const* constructor = contract->constructor())
- if (contract != &_contract && !constructor->parameters().empty())
- argumentsNeeded.insert(contract);
+ // Determine the arguments that are used for the base constructors.
for (ContractDefinition const* contract: bases)
{
if (FunctionDefinition const* constructor = contract->constructor())
for (auto const& modifier: constructor->modifiers())
{
- auto baseContract = dynamic_cast<ContractDefinition const*>(
- &dereference(*modifier->name())
- );
- if (baseContract)
- argumentsNeeded.erase(baseContract);
+ auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(*modifier->name()));
+ if (modifier->arguments())
+ {
+ if (baseContract && baseContract->constructor())
+ annotateBaseConstructorArguments(_contract, baseContract->constructor(), modifier.get());
+ }
+ else
+ {
+ if (v050)
+ m_errorReporter.declarationError(
+ modifier->location(),
+ "Modifier-style base constructor call without arguments."
+ );
+ else
+ m_errorReporter.warning(
+ modifier->location(),
+ "Modifier-style base constructor call without arguments."
+ );
+ }
}
-
for (ASTPointer<InheritanceSpecifier> const& base: contract->baseContracts())
{
auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(base->name()));
solAssert(baseContract, "");
- if (base->arguments() && !base->arguments()->empty())
- argumentsNeeded.erase(baseContract);
+
+ if (baseContract->constructor() && base->arguments() && !base->arguments()->empty())
+ annotateBaseConstructorArguments(_contract, baseContract->constructor(), base.get());
+ }
+ }
+
+ // check that we get arguments for all base constructors that need it.
+ // If not mark the contract as abstract (not fully implemented)
+ for (ContractDefinition const* contract: bases)
+ if (FunctionDefinition const* constructor = contract->constructor())
+ if (contract != &_contract && !constructor->parameters().empty())
+ if (!_contract.annotation().baseConstructorArguments.count(constructor))
+ _contract.annotation().unimplementedFunctions.push_back(constructor);
+}
+
+void TypeChecker::annotateBaseConstructorArguments(
+ ContractDefinition const& _currentContract,
+ FunctionDefinition const* _baseConstructor,
+ ASTNode const* _argumentNode
+)
+{
+ bool const v050 = _currentContract.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
+
+ solAssert(_baseConstructor, "");
+ solAssert(_argumentNode, "");
+
+ auto insertionResult = _currentContract.annotation().baseConstructorArguments.insert(
+ std::make_pair(_baseConstructor, _argumentNode)
+ );
+ if (!insertionResult.second)
+ {
+ ASTNode const* previousNode = insertionResult.first->second;
+
+ SourceLocation const* mainLocation = nullptr;
+ SecondarySourceLocation ssl;
+
+ if (
+ _currentContract.location().contains(previousNode->location()) ||
+ _currentContract.location().contains(_argumentNode->location())
+ )
+ {
+ mainLocation = &previousNode->location();
+ ssl.append("Second constructor call is here:", _argumentNode->location());
}
+ else
+ {
+ mainLocation = &_currentContract.location();
+ ssl.append("First constructor call is here: ", _argumentNode->location());
+ ssl.append("Second constructor call is here: ", previousNode->location());
+ }
+
+ if (v050)
+ m_errorReporter.declarationError(
+ *mainLocation,
+ ssl,
+ "Base constructor arguments given twice."
+ );
+ else
+ m_errorReporter.warning(
+ *mainLocation,
+ "Base constructor arguments given twice.",
+ ssl
+ );
}
- if (!argumentsNeeded.empty())
- for (ContractDefinition const* contract: argumentsNeeded)
- _contract.annotation().unimplementedFunctions.push_back(contract->constructor());
+
}
void TypeChecker::checkContractIllegalOverrides(ContractDefinition const& _contract)
@@ -756,7 +812,8 @@ void TypeChecker::visitManually(
vector<ContractDefinition const*> const& _bases
)
{
- std::vector<ASTPointer<Expression>> const& arguments = _modifier.arguments();
+ std::vector<ASTPointer<Expression>> const& arguments =
+ _modifier.arguments() ? *_modifier.arguments() : std::vector<ASTPointer<Expression>>();
for (ASTPointer<Expression> const& argument: arguments)
argument->accept(*this);
_modifier.name()->accept(*this);
@@ -794,7 +851,7 @@ void TypeChecker::visitManually(
);
return;
}
- for (size_t i = 0; i < _modifier.arguments().size(); ++i)
+ for (size_t i = 0; i < arguments.size(); ++i)
if (!type(*arguments[i])->isImplicitlyConvertibleTo(*type(*(*parameters)[i])))
m_errorReporter.typeError(
arguments[i]->location(),
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index 2ba31232..2245abd6 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -73,7 +73,12 @@ private:
void checkFunctionOverride(FunctionDefinition const& function, FunctionDefinition const& super);
void overrideError(FunctionDefinition const& function, FunctionDefinition const& super, std::string message);
void checkContractAbstractFunctions(ContractDefinition const& _contract);
- void checkContractAbstractConstructors(ContractDefinition const& _contract);
+ void checkContractBaseConstructorArguments(ContractDefinition const& _contract);
+ void annotateBaseConstructorArguments(
+ ContractDefinition const& _currentContract,
+ FunctionDefinition const* _baseConstructor,
+ ASTNode const* _argumentNode
+ );
/// Checks that different functions with external visibility end up having different
/// external argument types (i.e. different signature).
void checkContractExternalTypeClashes(ContractDefinition const& _contract);
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index bc85349b..ae253f0c 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -762,19 +762,22 @@ public:
ModifierInvocation(
SourceLocation const& _location,
ASTPointer<Identifier> const& _name,
- std::vector<ASTPointer<Expression>> _arguments
+ std::unique_ptr<std::vector<ASTPointer<Expression>>> _arguments
):
- ASTNode(_location), m_modifierName(_name), m_arguments(_arguments) {}
+ ASTNode(_location), m_modifierName(_name), m_arguments(std::move(_arguments)) {}
virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override;
ASTPointer<Identifier> const& name() const { return m_modifierName; }
- std::vector<ASTPointer<Expression>> const& arguments() const { return m_arguments; }
+ // Returns nullptr if no argument list was given (``mod``).
+ // If an argument list is given (``mod(...)``), the arguments are returned
+ // as a vector of expressions. Note that this vector can be empty (``mod()``).
+ std::vector<ASTPointer<Expression>> const* arguments() const { return m_arguments.get(); }
private:
ASTPointer<Identifier> m_modifierName;
- std::vector<ASTPointer<Expression>> m_arguments;
+ std::unique_ptr<std::vector<ASTPointer<Expression>>> m_arguments;
};
/**
diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h
index 3d4236cc..5cbe42bd 100644
--- a/libsolidity/ast/ASTAnnotations.h
+++ b/libsolidity/ast/ASTAnnotations.h
@@ -90,6 +90,9 @@ struct ContractDefinitionAnnotation: TypeDeclarationAnnotation, DocumentedAnnota
/// List of contracts this contract creates, i.e. which need to be compiled first.
/// Also includes all contracts from @a linearizedBaseContracts.
std::set<ContractDefinition const*> contractDependencies;
+ /// Mapping containing the nodes that define the arguments for base constructors.
+ /// These can either be inheritance specifiers or modifier invocations.
+ std::map<FunctionDefinition const*, ASTNode const*> baseConstructorArguments;
};
struct FunctionDefinitionAnnotation: ASTAnnotation, DocumentedAnnotation
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp
index 94932eca..95ba3089 100644
--- a/libsolidity/ast/ASTJsonConverter.cpp
+++ b/libsolidity/ast/ASTJsonConverter.cpp
@@ -268,7 +268,7 @@ bool ASTJsonConverter::visit(InheritanceSpecifier const& _node)
{
setJsonNode(_node, "InheritanceSpecifier", {
make_pair("baseName", toJson(_node.name())),
- make_pair("arguments", _node.arguments() ? toJson(*_node.arguments()) : Json::Value(Json::arrayValue))
+ make_pair("arguments", _node.arguments() ? toJson(*_node.arguments()) : Json::nullValue)
});
return false;
}
@@ -378,7 +378,7 @@ bool ASTJsonConverter::visit(ModifierInvocation const& _node)
{
setJsonNode(_node, "ModifierInvocation", {
make_pair("modifierName", toJson(*_node.name())),
- make_pair("arguments", toJson(_node.arguments()))
+ make_pair("arguments", _node.arguments() ? toJson(*_node.arguments()) : Json::nullValue)
});
return false;
}
diff --git a/libsolidity/ast/AST_accept.h b/libsolidity/ast/AST_accept.h
index dac414fc..aeff6e4a 100644
--- a/libsolidity/ast/AST_accept.h
+++ b/libsolidity/ast/AST_accept.h
@@ -264,7 +264,8 @@ void ModifierInvocation::accept(ASTVisitor& _visitor)
if (_visitor.visit(*this))
{
m_modifierName->accept(_visitor);
- listAccept(m_arguments, _visitor);
+ if (m_arguments)
+ listAccept(*m_arguments, _visitor);
}
_visitor.endVisit(*this);
}
@@ -274,7 +275,8 @@ void ModifierInvocation::accept(ASTConstVisitor& _visitor) const
if (_visitor.visit(*this))
{
m_modifierName->accept(_visitor);
- listAccept(m_arguments, _visitor);
+ if (m_arguments)
+ listAccept(*m_arguments, _visitor);
}
_visitor.endVisit(*this);
}
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index de359ec6..21353080 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -839,10 +839,10 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ
{
if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint)
{
- auto mobile = mobileType();
- if (!mobile)
+ auto commonType = Type::commonType(shared_from_this(), _other);
+ if (!commonType)
return TypePointer();
- return mobile->binaryOperatorResult(_operator, _other);
+ return commonType->binaryOperatorResult(_operator, _other);
}
else if (_other->category() != category())
return TypePointer();
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index aa46520f..05f506f1 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -403,7 +403,7 @@ private:
};
/**
- * Integer and fixed point constants either literals or computed.
+ * Integer and fixed point constants either literals or computed.
* Example expressions: 2, 3.14, 2+10.2, ~10.
* There is one distinct type per value.
*/
@@ -415,7 +415,7 @@ public:
/// @returns true if the literal is a valid integer.
static std::tuple<bool, rational> isValidLiteral(Literal const& _literal);
-
+
explicit RationalNumberType(rational const& _value):
m_value(_value)
{}
@@ -436,7 +436,7 @@ public:
/// @returns the smallest integer type that can hold the value or an empty pointer if not possible.
std::shared_ptr<IntegerType const> integerType() const;
- /// @returns the smallest fixed type that can hold the value or incurs the least precision loss.
+ /// @returns the smallest fixed type that can hold the value or incurs the least precision loss.
/// If the integer part does not fit, returns an empty pointer.
std::shared_ptr<FixedPointType const> fixedPointType() const;
@@ -778,7 +778,7 @@ public:
virtual std::string canonicalName() const override;
virtual std::string signatureInExternalFunction(bool _structsByName) const override;
- /// @returns a function that peforms the type conversion between a list of struct members
+ /// @returns a function that performs the type conversion between a list of struct members
/// and a memory struct of this type.
FunctionTypePointer constructorType() const;
@@ -1039,7 +1039,7 @@ public:
return *m_declaration;
}
bool hasDeclaration() const { return !!m_declaration; }
- /// @returns true if the the result of this function only depends on its arguments
+ /// @returns true if the result of this function only depends on its arguments
/// and it does not modify the state.
/// Currently, this will only return true for internal functions like keccak and ecrecover.
bool isPure() const;
@@ -1056,7 +1056,7 @@ public:
bool bound() const { return m_bound; }
/// @returns a copy of this type, where gas or value are set manually. This will never set one
- /// of the parameters to fals.
+ /// of the parameters to false.
TypePointer copyAndSetGasOrValue(bool _setGas, bool _setValue) const;
/// @returns a copy of this function type where all return parameters of dynamic size are
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index d3a7e4ea..5cb37103 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -135,34 +135,13 @@ void ContractCompiler::appendInitAndConstructorCode(ContractDefinition const& _c
{
solAssert(!_contract.isLibrary(), "Tried to initialize library.");
CompilerContext::LocationSetter locationSetter(m_context, _contract);
- // Determine the arguments that are used for the base constructors.
- std::vector<ContractDefinition const*> const& bases = _contract.annotation().linearizedBaseContracts;
- for (ContractDefinition const* contract: bases)
- {
- if (FunctionDefinition const* constructor = contract->constructor())
- for (auto const& modifier: constructor->modifiers())
- {
- auto baseContract = dynamic_cast<ContractDefinition const*>(
- modifier->name()->annotation().referencedDeclaration
- );
- if (baseContract && !modifier->arguments().empty())
- if (m_baseArguments.count(baseContract->constructor()) == 0)
- m_baseArguments[baseContract->constructor()] = &modifier->arguments();
- }
- for (ASTPointer<InheritanceSpecifier> const& base: contract->baseContracts())
- {
- ContractDefinition const* baseContract = dynamic_cast<ContractDefinition const*>(
- base->name().annotation().referencedDeclaration
- );
- solAssert(baseContract, "");
+ m_baseArguments = &_contract.annotation().baseConstructorArguments;
- if (!m_baseArguments.count(baseContract->constructor()) && base->arguments() && !base->arguments()->empty())
- m_baseArguments[baseContract->constructor()] = base->arguments();
- }
- }
// Initialization of state variables in base-to-derived order.
- for (ContractDefinition const* contract: boost::adaptors::reverse(bases))
+ for (ContractDefinition const* contract: boost::adaptors::reverse(
+ _contract.annotation().linearizedBaseContracts
+ ))
initializeStateVariables(*contract);
if (FunctionDefinition const* constructor = _contract.constructor())
@@ -236,8 +215,14 @@ void ContractCompiler::appendBaseConstructor(FunctionDefinition const& _construc
FunctionType constructorType(_constructor);
if (!constructorType.parameterTypes().empty())
{
- solAssert(m_baseArguments.count(&_constructor), "");
- std::vector<ASTPointer<Expression>> const* arguments = m_baseArguments[&_constructor];
+ solAssert(m_baseArguments, "");
+ solAssert(m_baseArguments->count(&_constructor), "");
+ std::vector<ASTPointer<Expression>> const* arguments = nullptr;
+ ASTNode const* baseArgumentNode = m_baseArguments->at(&_constructor);
+ if (auto inheritanceSpecifier = dynamic_cast<InheritanceSpecifier const*>(baseArgumentNode))
+ arguments = inheritanceSpecifier->arguments();
+ else if (auto modifierInvocation = dynamic_cast<ModifierInvocation const*>(baseArgumentNode))
+ arguments = modifierInvocation->arguments();
solAssert(arguments, "");
solAssert(arguments->size() == constructorType.parameterTypes().size(), "");
for (unsigned i = 0; i < arguments->size(); ++i)
@@ -912,13 +897,16 @@ void ContractCompiler::appendModifierOrFunctionCode()
);
ModifierDefinition const& modifier = m_context.resolveVirtualFunctionModifier(nonVirtualModifier);
CompilerContext::LocationSetter locationSetter(m_context, modifier);
- solAssert(modifier.parameters().size() == modifierInvocation->arguments().size(), "");
+ std::vector<ASTPointer<Expression>> const& modifierArguments =
+ modifierInvocation->arguments() ? *modifierInvocation->arguments() : std::vector<ASTPointer<Expression>>();
+
+ solAssert(modifier.parameters().size() == modifierArguments.size(), "");
for (unsigned i = 0; i < modifier.parameters().size(); ++i)
{
m_context.addVariable(*modifier.parameters()[i]);
addedVariables.push_back(modifier.parameters()[i].get());
compileExpression(
- *modifierInvocation->arguments()[i],
+ *modifierArguments[i],
modifier.parameters()[i]->annotation().type
);
}
diff --git a/libsolidity/codegen/ContractCompiler.h b/libsolidity/codegen/ContractCompiler.h
index e04a56fb..02a3452f 100644
--- a/libsolidity/codegen/ContractCompiler.h
+++ b/libsolidity/codegen/ContractCompiler.h
@@ -135,7 +135,7 @@ private:
FunctionDefinition const* m_currentFunction = nullptr;
unsigned m_stackCleanupForReturn = 0; ///< this number of stack elements need to be removed before jump to m_returnTag
// arguments for base constructors, filled in derived-to-base order
- std::map<FunctionDefinition const*, std::vector<ASTPointer<Expression>> const*> m_baseArguments;
+ std::map<FunctionDefinition const*, ASTNode const*> const* m_baseArguments;
};
}
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index eacfca9c..4ff14aa2 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -164,85 +164,94 @@ bool CompilerStack::analyze()
resolveImports();
bool noErrors = true;
- SyntaxChecker syntaxChecker(m_errorReporter);
- for (Source const* source: m_sourceOrder)
- if (!syntaxChecker.checkSyntax(*source->ast))
- noErrors = false;
-
- DocStringAnalyser docStringAnalyser(m_errorReporter);
- for (Source const* source: m_sourceOrder)
- if (!docStringAnalyser.analyseDocStrings(*source->ast))
- noErrors = false;
- m_globalContext = make_shared<GlobalContext>();
- NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter);
- for (Source const* source: m_sourceOrder)
- if (!resolver.registerDeclarations(*source->ast))
- return false;
-
- map<string, SourceUnit const*> sourceUnitsByName;
- for (auto& source: m_sources)
- sourceUnitsByName[source.first] = source.second.ast.get();
- for (Source const* source: m_sourceOrder)
- if (!resolver.performImports(*source->ast, sourceUnitsByName))
- return false;
+ try {
+ SyntaxChecker syntaxChecker(m_errorReporter);
+ for (Source const* source: m_sourceOrder)
+ if (!syntaxChecker.checkSyntax(*source->ast))
+ noErrors = false;
- for (Source const* source: m_sourceOrder)
- for (ASTPointer<ASTNode> const& node: source->ast->nodes())
- if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
- {
- m_globalContext->setCurrentContract(*contract);
- if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false;
- if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
- if (!resolver.resolveNamesAndTypes(*contract)) return false;
-
- // Note that we now reference contracts by their fully qualified names, and
- // thus contracts can only conflict if declared in the same source file. This
- // already causes a double-declaration error elsewhere, so we do not report
- // an error here and instead silently drop any additional contracts we find.
-
- if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
- m_contracts[contract->fullyQualifiedName()].contract = contract;
- }
+ DocStringAnalyser docStringAnalyser(m_errorReporter);
+ for (Source const* source: m_sourceOrder)
+ if (!docStringAnalyser.analyseDocStrings(*source->ast))
+ noErrors = false;
- TypeChecker typeChecker(m_evmVersion, m_errorReporter);
- for (Source const* source: m_sourceOrder)
- for (ASTPointer<ASTNode> const& node: source->ast->nodes())
- if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
- if (!typeChecker.checkTypeRequirements(*contract))
- noErrors = false;
+ m_globalContext = make_shared<GlobalContext>();
+ NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter);
+ for (Source const* source: m_sourceOrder)
+ if (!resolver.registerDeclarations(*source->ast))
+ return false;
- if (noErrors)
- {
- PostTypeChecker postTypeChecker(m_errorReporter);
+ map<string, SourceUnit const*> sourceUnitsByName;
+ for (auto& source: m_sources)
+ sourceUnitsByName[source.first] = source.second.ast.get();
for (Source const* source: m_sourceOrder)
- if (!postTypeChecker.check(*source->ast))
- noErrors = false;
- }
+ if (!resolver.performImports(*source->ast, sourceUnitsByName))
+ return false;
- if (noErrors)
- {
- StaticAnalyzer staticAnalyzer(m_errorReporter);
for (Source const* source: m_sourceOrder)
- if (!staticAnalyzer.analyze(*source->ast))
- noErrors = false;
- }
+ for (ASTPointer<ASTNode> const& node: source->ast->nodes())
+ if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
+ {
+ m_globalContext->setCurrentContract(*contract);
+ if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false;
+ if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
+ if (!resolver.resolveNamesAndTypes(*contract)) return false;
+
+ // Note that we now reference contracts by their fully qualified names, and
+ // thus contracts can only conflict if declared in the same source file. This
+ // already causes a double-declaration error elsewhere, so we do not report
+ // an error here and instead silently drop any additional contracts we find.
+
+ if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
+ m_contracts[contract->fullyQualifiedName()].contract = contract;
+ }
- if (noErrors)
- {
- vector<ASTPointer<ASTNode>> ast;
+ TypeChecker typeChecker(m_evmVersion, m_errorReporter);
for (Source const* source: m_sourceOrder)
- ast.push_back(source->ast);
+ for (ASTPointer<ASTNode> const& node: source->ast->nodes())
+ if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
+ if (!typeChecker.checkTypeRequirements(*contract))
+ noErrors = false;
- if (!ViewPureChecker(ast, m_errorReporter).check())
- noErrors = false;
- }
+ if (noErrors)
+ {
+ PostTypeChecker postTypeChecker(m_errorReporter);
+ for (Source const* source: m_sourceOrder)
+ if (!postTypeChecker.check(*source->ast))
+ noErrors = false;
+ }
- if (noErrors)
+ if (noErrors)
+ {
+ StaticAnalyzer staticAnalyzer(m_errorReporter);
+ for (Source const* source: m_sourceOrder)
+ if (!staticAnalyzer.analyze(*source->ast))
+ noErrors = false;
+ }
+
+ if (noErrors)
+ {
+ vector<ASTPointer<ASTNode>> ast;
+ for (Source const* source: m_sourceOrder)
+ ast.push_back(source->ast);
+
+ if (!ViewPureChecker(ast, m_errorReporter).check())
+ noErrors = false;
+ }
+
+ if (noErrors)
+ {
+ SMTChecker smtChecker(m_errorReporter, m_smtQuery);
+ for (Source const* source: m_sourceOrder)
+ smtChecker.analyze(*source->ast);
+ }
+ }
+ catch(FatalError const&)
{
- SMTChecker smtChecker(m_errorReporter, m_smtQuery);
- for (Source const* source: m_sourceOrder)
- smtChecker.analyze(*source->ast);
+ if (m_errorReporter.errors().empty())
+ throw; // Something is weird here, rather throw again.
+ noErrors = false;
}
if (noErrors)
diff --git a/libsolidity/interface/ErrorReporter.cpp b/libsolidity/interface/ErrorReporter.cpp
index e6171756..368e25e0 100644
--- a/libsolidity/interface/ErrorReporter.cpp
+++ b/libsolidity/interface/ErrorReporter.cpp
@@ -61,6 +61,9 @@ void ErrorReporter::warning(
void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, string const& _description)
{
+ if (checkForExcessiveErrors(_type))
+ return;
+
auto err = make_shared<Error>(_type);
*err <<
errinfo_sourceLocation(_location) <<
@@ -71,6 +74,9 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, st
void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description)
{
+ if (checkForExcessiveErrors(_type))
+ return;
+
auto err = make_shared<Error>(_type);
*err <<
errinfo_sourceLocation(_location) <<
@@ -80,6 +86,37 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, Se
m_errorList.push_back(err);
}
+bool ErrorReporter::checkForExcessiveErrors(Error::Type _type)
+{
+ if (_type == Error::Type::Warning)
+ {
+ m_warningCount++;
+
+ if (m_warningCount == c_maxWarningsAllowed)
+ {
+ auto err = make_shared<Error>(Error::Type::Warning);
+ *err << errinfo_comment("There are more than 256 warnings. Ignoring the rest.");
+ m_errorList.push_back(err);
+ }
+
+ if (m_warningCount >= c_maxWarningsAllowed)
+ return true;
+ }
+ else
+ {
+ m_errorCount++;
+
+ if (m_errorCount > c_maxErrorsAllowed)
+ {
+ auto err = make_shared<Error>(Error::Type::Warning);
+ *err << errinfo_comment("There are more than 256 errors. Aborting.");
+ m_errorList.push_back(err);
+ BOOST_THROW_EXCEPTION(FatalError());
+ }
+ }
+
+ return false;
+}
void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description)
{
diff --git a/libsolidity/interface/ErrorReporter.h b/libsolidity/interface/ErrorReporter.h
index a87db21d..d1a0030f 100644
--- a/libsolidity/interface/ErrorReporter.h
+++ b/libsolidity/interface/ErrorReporter.h
@@ -102,7 +102,16 @@ private:
SourceLocation const& _location = SourceLocation(),
std::string const& _description = std::string());
+ // @returns true if error shouldn't be stored
+ bool checkForExcessiveErrors(Error::Type _type);
+
ErrorList& m_errorList;
+
+ unsigned m_errorCount = 0;
+ unsigned m_warningCount = 0;
+
+ const unsigned c_maxWarningsAllowed = 256;
+ const unsigned c_maxErrorsAllowed = 256;
};
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 9a7731d8..18ef740a 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -701,17 +701,17 @@ ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
ASTPointer<Identifier> name(parseIdentifier());
- vector<ASTPointer<Expression>> arguments;
+ unique_ptr<vector<ASTPointer<Expression>>> arguments;
if (m_scanner->currentToken() == Token::LParen)
{
m_scanner->next();
- arguments = parseFunctionCallListArguments();
+ arguments.reset(new vector<ASTPointer<Expression>>(parseFunctionCallListArguments()));
nodeFactory.markEndPosition();
expectToken(Token::RParen);
}
else
nodeFactory.setEndPositionFromNode(name);
- return nodeFactory.createNode<ModifierInvocation>(name, arguments);
+ return nodeFactory.createNode<ModifierInvocation>(name, move(arguments));
}
ASTPointer<Identifier> Parser::parseIdentifier()
diff --git a/test/libsolidity/FormattedScope.h b/test/libsolidity/FormattedScope.h
index 78560848..923404f0 100644
--- a/test/libsolidity/FormattedScope.h
+++ b/test/libsolidity/FormattedScope.h
@@ -38,6 +38,8 @@ static constexpr char const* GREEN = "\033[1;32m";
static constexpr char const* YELLOW = "\033[1;33m";
static constexpr char const* CYAN = "\033[1;36m";
static constexpr char const* BOLD = "\033[1m";
+static constexpr char const* RED_BACKGROUND = "\033[48;5;160m";
+static constexpr char const* ORANGE_BACKGROUND = "\033[48;5;166m";
static constexpr char const* INVERSE = "\033[7m";
}
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 0a43069a..39f4b03e 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5191,7 +5191,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base)
}
uint public m_i;
}
- contract Derived is Base(2) {
+ contract Derived is Base {
function Derived(uint i) Base(i)
{}
}
@@ -5211,10 +5211,10 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base)
}
uint public m_i;
}
- contract Base1 is Base(3) {
+ contract Base1 is Base {
function Base1(uint k) Base(k*k) {}
}
- contract Derived is Base(3), Base1(2) {
+ contract Derived is Base, Base1 {
function Derived(uint i) Base(i) Base1(i)
{}
}
@@ -5235,7 +5235,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base_with_gap)
uint public m_i;
}
contract Base1 is Base(3) {}
- contract Derived is Base(2), Base1 {
+ contract Derived is Base, Base1 {
function Derived(uint i) Base(i) {}
}
contract Final is Derived(4) {
diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp
index 329543bf..1c2355d5 100644
--- a/test/libsolidity/SyntaxTest.cpp
+++ b/test/libsolidity/SyntaxTest.cpp
@@ -34,17 +34,38 @@ namespace fs = boost::filesystem;
using namespace boost::unit_test;
template<typename IteratorType>
-void skipWhitespace(IteratorType& it, IteratorType end)
+void skipWhitespace(IteratorType& _it, IteratorType _end)
{
- while (it != end && isspace(*it))
- ++it;
+ while (_it != _end && isspace(*_it))
+ ++_it;
}
template<typename IteratorType>
-void skipSlashes(IteratorType& it, IteratorType end)
+void skipSlashes(IteratorType& _it, IteratorType _end)
{
- while (it != end && *it == '/')
- ++it;
+ while (_it != _end && *_it == '/')
+ ++_it;
+}
+
+void expect(string::iterator& _it, string::iterator _end, string::value_type _c)
+{
+ if (_it == _end || *_it != _c)
+ throw runtime_error(string("Invalid test expectation. Expected: \"") + _c + "\".");
+ ++_it;
+}
+
+int parseUnsignedInteger(string::iterator &_it, string::iterator _end)
+{
+ if (_it == _end || !isdigit(*_it))
+ throw runtime_error("Invalid test expectation. Source location expected.");
+ int result = 0;
+ while (_it != _end && isdigit(*_it))
+ {
+ result *= 10;
+ result += *_it - '0';
+ ++_it;
+ }
+ return result;
}
SyntaxTest::SyntaxTest(string const& _filename)
@@ -60,22 +81,39 @@ SyntaxTest::SyntaxTest(string const& _filename)
bool SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
{
+ string const versionPragma = "pragma solidity >=0.0;\n";
m_compiler.reset();
- m_compiler.addSource("", "pragma solidity >=0.0;\n" + m_source);
+ m_compiler.addSource("", versionPragma + m_source);
m_compiler.setEVMVersion(dev::test::Options::get().evmVersion());
if (m_compiler.parse())
m_compiler.analyze();
for (auto const& currentError: filterErrors(m_compiler.errors(), true))
- m_errorList.emplace_back(SyntaxTestError{currentError->typeName(), errorMessage(*currentError)});
+ {
+ int locationStart = -1, locationEnd = -1;
+ if (auto location = boost::get_error_info<errinfo_sourceLocation>(*currentError))
+ {
+ // ignore the version pragma inserted by the testing tool when calculating locations.
+ if (location->start >= static_cast<int>(versionPragma.size()))
+ locationStart = location->start - versionPragma.size();
+ if (location->end >= static_cast<int>(versionPragma.size()))
+ locationEnd = location->end - versionPragma.size();
+ }
+ m_errorList.emplace_back(SyntaxTestError{
+ currentError->typeName(),
+ errorMessage(*currentError),
+ locationStart,
+ locationEnd
+ });
+ }
if (m_expectations != m_errorList)
{
string nextIndentLevel = _linePrefix + " ";
FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl;
printErrorList(_stream, m_expectations, nextIndentLevel, _formatted);
- FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:\n";
+ FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:" << endl;
printErrorList(_stream, m_errorList, nextIndentLevel, _formatted);
return false;
}
@@ -99,6 +137,16 @@ void SyntaxTest::printErrorList(
_stream << _linePrefix;
_stream << error.type << ": ";
}
+ if (error.locationStart >= 0 || error.locationEnd >= 0)
+ {
+ _stream << "(";
+ if (error.locationStart >= 0)
+ _stream << error.locationStart;
+ _stream << "-";
+ if (error.locationEnd >= 0)
+ _stream << error.locationEnd;
+ _stream << "): ";
+ }
_stream << error.message << endl;
}
}
@@ -147,8 +195,28 @@ vector<SyntaxTestError> SyntaxTest::parseExpectations(istream& _stream)
skipWhitespace(it, line.end());
+ int locationStart = -1;
+ int locationEnd = -1;
+
+ if (it != line.end() && *it == '(')
+ {
+ ++it;
+ locationStart = parseUnsignedInteger(it, line.end());
+ expect(it, line.end(), '-');
+ locationEnd = parseUnsignedInteger(it, line.end());
+ expect(it, line.end(), ')');
+ expect(it, line.end(), ':');
+ }
+
+ skipWhitespace(it, line.end());
+
string errorMessage(it, line.end());
- expectations.emplace_back(SyntaxTestError{move(errorType), move(errorMessage)});
+ expectations.emplace_back(SyntaxTestError{
+ move(errorType),
+ move(errorMessage),
+ locationStart,
+ locationEnd
+ });
}
return expectations;
}
diff --git a/test/libsolidity/SyntaxTest.h b/test/libsolidity/SyntaxTest.h
index dddd86ef..6159e789 100644
--- a/test/libsolidity/SyntaxTest.h
+++ b/test/libsolidity/SyntaxTest.h
@@ -40,9 +40,14 @@ struct SyntaxTestError
{
std::string type;
std::string message;
+ int locationStart;
+ int locationEnd;
bool operator==(SyntaxTestError const& _rhs) const
{
- return type == _rhs.type && message == _rhs.message;
+ return type == _rhs.type &&
+ message == _rhs.message &&
+ locationStart == _rhs.locationStart &&
+ locationEnd == _rhs.locationEnd;
}
};
diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol
index 2b6aa088..cb553fbe 100644
--- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol
+++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol
@@ -2,4 +2,4 @@ contract C {
uint constant a = a;
}
// ----
-// TypeError: The value of the constant a has a cyclic dependency via a.
+// TypeError: (17-36): The value of the constant a has a cyclic dependency via a.
diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol
index 461979f8..00f9bb0f 100644
--- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol
+++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol
@@ -5,6 +5,6 @@ contract C {
uint constant d = 2 + a;
}
// ----
-// TypeError: The value of the constant a has a cyclic dependency via c.
-// TypeError: The value of the constant c has a cyclic dependency via d.
-// TypeError: The value of the constant d has a cyclic dependency via a.
+// TypeError: (17-40): The value of the constant a has a cyclic dependency via c.
+// TypeError: (71-111): The value of the constant c has a cyclic dependency via d.
+// TypeError: (117-140): The value of the constant d has a cyclic dependency via a.
diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol
index f63be05e..969ed50d 100644
--- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol
+++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol
@@ -5,7 +5,7 @@ contract C {
uint constant c = b;
}
// ----
-// TypeError: The value of the constant x has a cyclic dependency via a.
-// TypeError: The value of the constant a has a cyclic dependency via b.
-// TypeError: The value of the constant b has a cyclic dependency via c.
-// TypeError: The value of the constant c has a cyclic dependency via b.
+// TypeError: (17-36): The value of the constant x has a cyclic dependency via a.
+// TypeError: (42-65): The value of the constant a has a cyclic dependency via b.
+// TypeError: (71-90): The value of the constant b has a cyclic dependency via c.
+// TypeError: (96-115): The value of the constant c has a cyclic dependency via b.
diff --git a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol
index c5507b64..fda4a17a 100644
--- a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol
+++ b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol
@@ -3,4 +3,4 @@ contract test {
uint128 variable;
}
// ----
-// DeclarationError: Identifier already declared.
+// DeclarationError: (36-52): Identifier already declared.
diff --git a/test/libsolidity/syntaxTests/double_variable_declaration.sol b/test/libsolidity/syntaxTests/double_variable_declaration.sol
index 3349cfec..9ab87959 100644
--- a/test/libsolidity/syntaxTests/double_variable_declaration.sol
+++ b/test/libsolidity/syntaxTests/double_variable_declaration.sol
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
-// DeclarationError: Identifier already declared.
+// DeclarationError: (71-80): Identifier already declared.
diff --git a/test/libsolidity/syntaxTests/double_variable_declaration_050.sol b/test/libsolidity/syntaxTests/double_variable_declaration_050.sol
index 9c2d40d5..2f47e6dc 100644
--- a/test/libsolidity/syntaxTests/double_variable_declaration_050.sol
+++ b/test/libsolidity/syntaxTests/double_variable_declaration_050.sol
@@ -6,6 +6,6 @@ contract test {
}
}
// ----
-// Warning: This declaration shadows an existing declaration.
-// Warning: Unused local variable.
-// Warning: Unused local variable.
+// Warning: (101-110): This declaration shadows an existing declaration.
+// Warning: (76-85): Unused local variable.
+// Warning: (101-110): Unused local variable.
diff --git a/test/libsolidity/syntaxTests/empty_struct.sol b/test/libsolidity/syntaxTests/empty_struct.sol
index dcced618..12655309 100644
--- a/test/libsolidity/syntaxTests/empty_struct.sol
+++ b/test/libsolidity/syntaxTests/empty_struct.sol
@@ -2,4 +2,4 @@ contract test {
struct A {}
}
// ----
-// Warning: Defining empty structs is deprecated.
+// Warning: (17-28): Defining empty structs is deprecated.
diff --git a/test/libsolidity/syntaxTests/empty_struct_050.sol b/test/libsolidity/syntaxTests/empty_struct_050.sol
index dbec93c4..886f1f83 100644
--- a/test/libsolidity/syntaxTests/empty_struct_050.sol
+++ b/test/libsolidity/syntaxTests/empty_struct_050.sol
@@ -3,4 +3,4 @@ contract test {
struct A {}
}
// ----
-// SyntaxError: Defining empty structs is disallowed.
+// SyntaxError: (47-58): Defining empty structs is disallowed.
diff --git a/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol b/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol
new file mode 100644
index 00000000..ce9d5f5f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol
@@ -0,0 +1,2 @@
+contract A { constructor() public { } }
+contract B is A { constructor() A() public { } }
diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol
index b3fbd04a..0b18b995 100644
--- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol
+++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol
@@ -4,4 +4,4 @@ contract Base {
contract Derived is Base(2) { }
contract Derived2 is Base(), Derived() { }
// ----
-// Warning: Wrong argument count for constructor call: 0 arguments given but expected 1.
+// Warning: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1.
diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol
index b3728634..db04ab8c 100644
--- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol
+++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol
@@ -6,4 +6,4 @@ contract Base {
contract Derived is Base(2) { }
contract Derived2 is Base(), Derived() { }
// ----
-// TypeError: Wrong argument count for constructor call: 0 arguments given but expected 1.
+// TypeError: (132-138): Wrong argument count for constructor call: 0 arguments given but expected 1.
diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol
new file mode 100644
index 00000000..015b33e5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol
@@ -0,0 +1,9 @@
+contract Base {
+ constructor(uint) public { }
+}
+contract Base1 is Base(3) {}
+contract Derived is Base, Base1 {
+ constructor(uint i) Base(i) public {}
+}
+// ----
+// Warning: (138-145): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol
new file mode 100644
index 00000000..6cf68d2a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol
@@ -0,0 +1,4 @@
+contract A { constructor() public { } }
+contract B is A { constructor() A public { } }
+// ----
+// Warning: (72-73): Modifier-style base constructor call without arguments.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol
new file mode 100644
index 00000000..24cff54d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol
@@ -0,0 +1,5 @@
+contract A { constructor(uint) public { } }
+contract B is A(2) { constructor() public { } }
+contract C is B { constructor() A(3) public { } }
+// ----
+// Warning: (125-129): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol
new file mode 100644
index 00000000..8d5df5bf
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol
@@ -0,0 +1,7 @@
+pragma experimental "v0.5.0";
+
+contract A { constructor(uint) public { } }
+contract B is A(2) { constructor() public { } }
+contract C is B { constructor() A(3) public { } }
+// ----
+// DeclarationError: (156-160): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol
new file mode 100644
index 00000000..9ceaea5e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol
@@ -0,0 +1,4 @@
+contract A { constructor(uint) public { } }
+contract B is A(2) { constructor() A(3) public { } }
+// ----
+// Warning: (79-83): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol
new file mode 100644
index 00000000..f9325f99
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol
@@ -0,0 +1,6 @@
+pragma experimental "v0.5.0";
+
+contract A { constructor(uint) public { } }
+contract B is A(2) { constructor() A(3) public { } }
+// ----
+// DeclarationError: (110-114): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol
new file mode 100644
index 00000000..e5c2aa36
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol
@@ -0,0 +1,7 @@
+contract C { constructor(uint) public {} }
+contract A is C(2) {}
+contract B is C(2) {}
+contract D is A, B { constructor() C(3) public {} }
+// ----
+// Warning: (122-126): Base constructor arguments given twice.
+// Warning: (122-126): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol
new file mode 100644
index 00000000..1abf2992
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol
@@ -0,0 +1,6 @@
+contract C { constructor(uint) public {} }
+contract A is C(2) {}
+contract B is C(2) {}
+contract D is A, B {}
+// ----
+// Warning: (87-108): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol
new file mode 100644
index 00000000..e15242db
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol
@@ -0,0 +1,6 @@
+contract C { constructor(uint) public {} }
+contract A is C { constructor() C(2) public {} }
+contract B is C { constructor() C(2) public {} }
+contract D is A, B { }
+// ----
+// Warning: (141-163): Base constructor arguments given twice.
diff --git a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol
index 45a0770f..c55c41f2 100644
--- a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol
+++ b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol
@@ -6,5 +6,5 @@ contract Derived2 is Base {
constructor() Base(2) public { }
}
// ----
-// TypeError: Wrong argument count for constructor call: 1 arguments given but expected 2.
-// TypeError: Wrong argument count for modifier invocation: 1 arguments given but expected 2.
+// TypeError: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2.
+// TypeError: (130-137): Wrong argument count for modifier invocation: 1 arguments given but expected 2.
diff --git a/test/libsolidity/syntaxTests/literal_comparisons.sol b/test/libsolidity/syntaxTests/literal_comparisons.sol
new file mode 100644
index 00000000..dd2afcaa
--- /dev/null
+++ b/test/libsolidity/syntaxTests/literal_comparisons.sol
@@ -0,0 +1,7 @@
+contract test {
+ function f(int8 x) public pure {
+ if (x == 1) {}
+ if (1 == x) {}
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol
new file mode 100644
index 00000000..2d75f29b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol
@@ -0,0 +1,524 @@
+contract C {
+ function f() {
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ b = 5;
+ }
+}
+// ----
+// DeclarationError: (34-35): Undeclared identifier.
+// DeclarationError: (45-46): Undeclared identifier.
+// DeclarationError: (56-57): Undeclared identifier.
+// DeclarationError: (67-68): Undeclared identifier.
+// DeclarationError: (78-79): Undeclared identifier.
+// DeclarationError: (89-90): Undeclared identifier.
+// DeclarationError: (100-101): Undeclared identifier.
+// DeclarationError: (111-112): Undeclared identifier.
+// DeclarationError: (122-123): Undeclared identifier.
+// DeclarationError: (133-134): Undeclared identifier.
+// DeclarationError: (144-145): Undeclared identifier.
+// DeclarationError: (155-156): Undeclared identifier.
+// DeclarationError: (166-167): Undeclared identifier.
+// DeclarationError: (177-178): Undeclared identifier.
+// DeclarationError: (188-189): Undeclared identifier.
+// DeclarationError: (199-200): Undeclared identifier.
+// DeclarationError: (210-211): Undeclared identifier.
+// DeclarationError: (221-222): Undeclared identifier.
+// DeclarationError: (232-233): Undeclared identifier.
+// DeclarationError: (243-244): Undeclared identifier.
+// DeclarationError: (254-255): Undeclared identifier.
+// DeclarationError: (265-266): Undeclared identifier.
+// DeclarationError: (276-277): Undeclared identifier.
+// DeclarationError: (287-288): Undeclared identifier.
+// DeclarationError: (298-299): Undeclared identifier.
+// DeclarationError: (309-310): Undeclared identifier.
+// DeclarationError: (320-321): Undeclared identifier.
+// DeclarationError: (331-332): Undeclared identifier.
+// DeclarationError: (342-343): Undeclared identifier.
+// DeclarationError: (353-354): Undeclared identifier.
+// DeclarationError: (364-365): Undeclared identifier.
+// DeclarationError: (375-376): Undeclared identifier.
+// DeclarationError: (386-387): Undeclared identifier.
+// DeclarationError: (397-398): Undeclared identifier.
+// DeclarationError: (408-409): Undeclared identifier.
+// DeclarationError: (419-420): Undeclared identifier.
+// DeclarationError: (430-431): Undeclared identifier.
+// DeclarationError: (441-442): Undeclared identifier.
+// DeclarationError: (452-453): Undeclared identifier.
+// DeclarationError: (463-464): Undeclared identifier.
+// DeclarationError: (474-475): Undeclared identifier.
+// DeclarationError: (485-486): Undeclared identifier.
+// DeclarationError: (496-497): Undeclared identifier.
+// DeclarationError: (507-508): Undeclared identifier.
+// DeclarationError: (518-519): Undeclared identifier.
+// DeclarationError: (529-530): Undeclared identifier.
+// DeclarationError: (540-541): Undeclared identifier.
+// DeclarationError: (551-552): Undeclared identifier.
+// DeclarationError: (562-563): Undeclared identifier.
+// DeclarationError: (573-574): Undeclared identifier.
+// DeclarationError: (584-585): Undeclared identifier.
+// DeclarationError: (595-596): Undeclared identifier.
+// DeclarationError: (606-607): Undeclared identifier.
+// DeclarationError: (617-618): Undeclared identifier.
+// DeclarationError: (628-629): Undeclared identifier.
+// DeclarationError: (639-640): Undeclared identifier.
+// DeclarationError: (650-651): Undeclared identifier.
+// DeclarationError: (661-662): Undeclared identifier.
+// DeclarationError: (672-673): Undeclared identifier.
+// DeclarationError: (683-684): Undeclared identifier.
+// DeclarationError: (694-695): Undeclared identifier.
+// DeclarationError: (705-706): Undeclared identifier.
+// DeclarationError: (716-717): Undeclared identifier.
+// DeclarationError: (727-728): Undeclared identifier.
+// DeclarationError: (738-739): Undeclared identifier.
+// DeclarationError: (749-750): Undeclared identifier.
+// DeclarationError: (760-761): Undeclared identifier.
+// DeclarationError: (771-772): Undeclared identifier.
+// DeclarationError: (782-783): Undeclared identifier.
+// DeclarationError: (793-794): Undeclared identifier.
+// DeclarationError: (804-805): Undeclared identifier.
+// DeclarationError: (815-816): Undeclared identifier.
+// DeclarationError: (826-827): Undeclared identifier.
+// DeclarationError: (837-838): Undeclared identifier.
+// DeclarationError: (848-849): Undeclared identifier.
+// DeclarationError: (859-860): Undeclared identifier.
+// DeclarationError: (870-871): Undeclared identifier.
+// DeclarationError: (881-882): Undeclared identifier.
+// DeclarationError: (892-893): Undeclared identifier.
+// DeclarationError: (903-904): Undeclared identifier.
+// DeclarationError: (914-915): Undeclared identifier.
+// DeclarationError: (925-926): Undeclared identifier.
+// DeclarationError: (936-937): Undeclared identifier.
+// DeclarationError: (947-948): Undeclared identifier.
+// DeclarationError: (958-959): Undeclared identifier.
+// DeclarationError: (969-970): Undeclared identifier.
+// DeclarationError: (980-981): Undeclared identifier.
+// DeclarationError: (991-992): Undeclared identifier.
+// DeclarationError: (1002-1003): Undeclared identifier.
+// DeclarationError: (1013-1014): Undeclared identifier.
+// DeclarationError: (1024-1025): Undeclared identifier.
+// DeclarationError: (1035-1036): Undeclared identifier.
+// DeclarationError: (1046-1047): Undeclared identifier.
+// DeclarationError: (1057-1058): Undeclared identifier.
+// DeclarationError: (1068-1069): Undeclared identifier.
+// DeclarationError: (1079-1080): Undeclared identifier.
+// DeclarationError: (1090-1091): Undeclared identifier.
+// DeclarationError: (1101-1102): Undeclared identifier.
+// DeclarationError: (1112-1113): Undeclared identifier.
+// DeclarationError: (1123-1124): Undeclared identifier.
+// DeclarationError: (1134-1135): Undeclared identifier.
+// DeclarationError: (1145-1146): Undeclared identifier.
+// DeclarationError: (1156-1157): Undeclared identifier.
+// DeclarationError: (1167-1168): Undeclared identifier.
+// DeclarationError: (1178-1179): Undeclared identifier.
+// DeclarationError: (1189-1190): Undeclared identifier.
+// DeclarationError: (1200-1201): Undeclared identifier.
+// DeclarationError: (1211-1212): Undeclared identifier.
+// DeclarationError: (1222-1223): Undeclared identifier.
+// DeclarationError: (1233-1234): Undeclared identifier.
+// DeclarationError: (1244-1245): Undeclared identifier.
+// DeclarationError: (1255-1256): Undeclared identifier.
+// DeclarationError: (1266-1267): Undeclared identifier.
+// DeclarationError: (1277-1278): Undeclared identifier.
+// DeclarationError: (1288-1289): Undeclared identifier.
+// DeclarationError: (1299-1300): Undeclared identifier.
+// DeclarationError: (1310-1311): Undeclared identifier.
+// DeclarationError: (1321-1322): Undeclared identifier.
+// DeclarationError: (1332-1333): Undeclared identifier.
+// DeclarationError: (1343-1344): Undeclared identifier.
+// DeclarationError: (1354-1355): Undeclared identifier.
+// DeclarationError: (1365-1366): Undeclared identifier.
+// DeclarationError: (1376-1377): Undeclared identifier.
+// DeclarationError: (1387-1388): Undeclared identifier.
+// DeclarationError: (1398-1399): Undeclared identifier.
+// DeclarationError: (1409-1410): Undeclared identifier.
+// DeclarationError: (1420-1421): Undeclared identifier.
+// DeclarationError: (1431-1432): Undeclared identifier.
+// DeclarationError: (1442-1443): Undeclared identifier.
+// DeclarationError: (1453-1454): Undeclared identifier.
+// DeclarationError: (1464-1465): Undeclared identifier.
+// DeclarationError: (1475-1476): Undeclared identifier.
+// DeclarationError: (1486-1487): Undeclared identifier.
+// DeclarationError: (1497-1498): Undeclared identifier.
+// DeclarationError: (1508-1509): Undeclared identifier.
+// DeclarationError: (1519-1520): Undeclared identifier.
+// DeclarationError: (1530-1531): Undeclared identifier.
+// DeclarationError: (1541-1542): Undeclared identifier.
+// DeclarationError: (1552-1553): Undeclared identifier.
+// DeclarationError: (1563-1564): Undeclared identifier.
+// DeclarationError: (1574-1575): Undeclared identifier.
+// DeclarationError: (1585-1586): Undeclared identifier.
+// DeclarationError: (1596-1597): Undeclared identifier.
+// DeclarationError: (1607-1608): Undeclared identifier.
+// DeclarationError: (1618-1619): Undeclared identifier.
+// DeclarationError: (1629-1630): Undeclared identifier.
+// DeclarationError: (1640-1641): Undeclared identifier.
+// DeclarationError: (1651-1652): Undeclared identifier.
+// DeclarationError: (1662-1663): Undeclared identifier.
+// DeclarationError: (1673-1674): Undeclared identifier.
+// DeclarationError: (1684-1685): Undeclared identifier.
+// DeclarationError: (1695-1696): Undeclared identifier.
+// DeclarationError: (1706-1707): Undeclared identifier.
+// DeclarationError: (1717-1718): Undeclared identifier.
+// DeclarationError: (1728-1729): Undeclared identifier.
+// DeclarationError: (1739-1740): Undeclared identifier.
+// DeclarationError: (1750-1751): Undeclared identifier.
+// DeclarationError: (1761-1762): Undeclared identifier.
+// DeclarationError: (1772-1773): Undeclared identifier.
+// DeclarationError: (1783-1784): Undeclared identifier.
+// DeclarationError: (1794-1795): Undeclared identifier.
+// DeclarationError: (1805-1806): Undeclared identifier.
+// DeclarationError: (1816-1817): Undeclared identifier.
+// DeclarationError: (1827-1828): Undeclared identifier.
+// DeclarationError: (1838-1839): Undeclared identifier.
+// DeclarationError: (1849-1850): Undeclared identifier.
+// DeclarationError: (1860-1861): Undeclared identifier.
+// DeclarationError: (1871-1872): Undeclared identifier.
+// DeclarationError: (1882-1883): Undeclared identifier.
+// DeclarationError: (1893-1894): Undeclared identifier.
+// DeclarationError: (1904-1905): Undeclared identifier.
+// DeclarationError: (1915-1916): Undeclared identifier.
+// DeclarationError: (1926-1927): Undeclared identifier.
+// DeclarationError: (1937-1938): Undeclared identifier.
+// DeclarationError: (1948-1949): Undeclared identifier.
+// DeclarationError: (1959-1960): Undeclared identifier.
+// DeclarationError: (1970-1971): Undeclared identifier.
+// DeclarationError: (1981-1982): Undeclared identifier.
+// DeclarationError: (1992-1993): Undeclared identifier.
+// DeclarationError: (2003-2004): Undeclared identifier.
+// DeclarationError: (2014-2015): Undeclared identifier.
+// DeclarationError: (2025-2026): Undeclared identifier.
+// DeclarationError: (2036-2037): Undeclared identifier.
+// DeclarationError: (2047-2048): Undeclared identifier.
+// DeclarationError: (2058-2059): Undeclared identifier.
+// DeclarationError: (2069-2070): Undeclared identifier.
+// DeclarationError: (2080-2081): Undeclared identifier.
+// DeclarationError: (2091-2092): Undeclared identifier.
+// DeclarationError: (2102-2103): Undeclared identifier.
+// DeclarationError: (2113-2114): Undeclared identifier.
+// DeclarationError: (2124-2125): Undeclared identifier.
+// DeclarationError: (2135-2136): Undeclared identifier.
+// DeclarationError: (2146-2147): Undeclared identifier.
+// DeclarationError: (2157-2158): Undeclared identifier.
+// DeclarationError: (2168-2169): Undeclared identifier.
+// DeclarationError: (2179-2180): Undeclared identifier.
+// DeclarationError: (2190-2191): Undeclared identifier.
+// DeclarationError: (2201-2202): Undeclared identifier.
+// DeclarationError: (2212-2213): Undeclared identifier.
+// DeclarationError: (2223-2224): Undeclared identifier.
+// DeclarationError: (2234-2235): Undeclared identifier.
+// DeclarationError: (2245-2246): Undeclared identifier.
+// DeclarationError: (2256-2257): Undeclared identifier.
+// DeclarationError: (2267-2268): Undeclared identifier.
+// DeclarationError: (2278-2279): Undeclared identifier.
+// DeclarationError: (2289-2290): Undeclared identifier.
+// DeclarationError: (2300-2301): Undeclared identifier.
+// DeclarationError: (2311-2312): Undeclared identifier.
+// DeclarationError: (2322-2323): Undeclared identifier.
+// DeclarationError: (2333-2334): Undeclared identifier.
+// DeclarationError: (2344-2345): Undeclared identifier.
+// DeclarationError: (2355-2356): Undeclared identifier.
+// DeclarationError: (2366-2367): Undeclared identifier.
+// DeclarationError: (2377-2378): Undeclared identifier.
+// DeclarationError: (2388-2389): Undeclared identifier.
+// DeclarationError: (2399-2400): Undeclared identifier.
+// DeclarationError: (2410-2411): Undeclared identifier.
+// DeclarationError: (2421-2422): Undeclared identifier.
+// DeclarationError: (2432-2433): Undeclared identifier.
+// DeclarationError: (2443-2444): Undeclared identifier.
+// DeclarationError: (2454-2455): Undeclared identifier.
+// DeclarationError: (2465-2466): Undeclared identifier.
+// DeclarationError: (2476-2477): Undeclared identifier.
+// DeclarationError: (2487-2488): Undeclared identifier.
+// DeclarationError: (2498-2499): Undeclared identifier.
+// DeclarationError: (2509-2510): Undeclared identifier.
+// DeclarationError: (2520-2521): Undeclared identifier.
+// DeclarationError: (2531-2532): Undeclared identifier.
+// DeclarationError: (2542-2543): Undeclared identifier.
+// DeclarationError: (2553-2554): Undeclared identifier.
+// DeclarationError: (2564-2565): Undeclared identifier.
+// DeclarationError: (2575-2576): Undeclared identifier.
+// DeclarationError: (2586-2587): Undeclared identifier.
+// DeclarationError: (2597-2598): Undeclared identifier.
+// DeclarationError: (2608-2609): Undeclared identifier.
+// DeclarationError: (2619-2620): Undeclared identifier.
+// DeclarationError: (2630-2631): Undeclared identifier.
+// DeclarationError: (2641-2642): Undeclared identifier.
+// DeclarationError: (2652-2653): Undeclared identifier.
+// DeclarationError: (2663-2664): Undeclared identifier.
+// DeclarationError: (2674-2675): Undeclared identifier.
+// DeclarationError: (2685-2686): Undeclared identifier.
+// DeclarationError: (2696-2697): Undeclared identifier.
+// DeclarationError: (2707-2708): Undeclared identifier.
+// DeclarationError: (2718-2719): Undeclared identifier.
+// DeclarationError: (2729-2730): Undeclared identifier.
+// DeclarationError: (2740-2741): Undeclared identifier.
+// DeclarationError: (2751-2752): Undeclared identifier.
+// DeclarationError: (2762-2763): Undeclared identifier.
+// DeclarationError: (2773-2774): Undeclared identifier.
+// DeclarationError: (2784-2785): Undeclared identifier.
+// DeclarationError: (2795-2796): Undeclared identifier.
+// DeclarationError: (2806-2807): Undeclared identifier.
+// DeclarationError: (2817-2818): Undeclared identifier.
+// DeclarationError: (2828-2829): Undeclared identifier.
+// DeclarationError: (2839-2840): Undeclared identifier.
+// Warning: There are more than 256 errors. Aborting.
diff --git a/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol
new file mode 100644
index 00000000..2c9b8a42
--- /dev/null
+++ b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol
@@ -0,0 +1,524 @@
+contract C {
+ function f() {
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ }
+}
+// ----
+// SyntaxError: (34-42): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (48-56): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (62-70): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (76-84): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (90-98): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (104-112): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (118-126): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (132-140): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (146-154): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (160-168): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (174-182): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (188-196): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (202-210): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (216-224): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (230-238): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (244-252): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (258-266): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (272-280): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (286-294): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (300-308): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (314-322): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (328-336): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (342-350): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (356-364): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (370-378): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (384-392): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (398-406): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (412-420): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (426-434): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (440-448): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (454-462): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (468-476): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (482-490): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (496-504): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (510-518): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (524-532): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (538-546): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (552-560): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (566-574): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (580-588): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (594-602): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (608-616): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (622-630): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (636-644): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (650-658): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (664-672): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (678-686): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (692-700): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (706-714): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (720-728): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (734-742): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (748-756): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (762-770): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (776-784): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (790-798): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (804-812): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (818-826): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (832-840): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (846-854): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (860-868): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (874-882): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (888-896): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (902-910): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (916-924): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (930-938): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (944-952): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (958-966): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (972-980): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (986-994): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1000-1008): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1014-1022): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1028-1036): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1042-1050): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1056-1064): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1070-1078): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1084-1092): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1098-1106): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1112-1120): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1126-1134): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1140-1148): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1154-1162): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1168-1176): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1182-1190): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1196-1204): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1210-1218): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1224-1232): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1238-1246): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1252-1260): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1266-1274): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1280-1288): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1294-1302): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1308-1316): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1322-1330): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1336-1344): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1350-1358): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1364-1372): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1378-1386): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1392-1400): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1406-1414): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1420-1428): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1434-1442): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1448-1456): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1462-1470): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1476-1484): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1490-1498): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1504-1512): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1518-1526): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1532-1540): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1546-1554): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1560-1568): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1574-1582): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1588-1596): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1602-1610): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1616-1624): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1630-1638): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1644-1652): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1658-1666): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1672-1680): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1686-1694): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1700-1708): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1714-1722): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1728-1736): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1742-1750): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1756-1764): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1770-1778): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1784-1792): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1798-1806): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1812-1820): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1826-1834): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1840-1848): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1854-1862): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1868-1876): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1882-1890): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1896-1904): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1910-1918): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1924-1932): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1938-1946): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1952-1960): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1966-1974): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1980-1988): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (1994-2002): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2008-2016): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2022-2030): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2036-2044): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2050-2058): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2064-2072): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2078-2086): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2092-2100): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2106-2114): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2120-2128): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2134-2142): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2148-2156): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2162-2170): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2176-2184): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2190-2198): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2204-2212): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2218-2226): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2232-2240): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2246-2254): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2260-2268): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2274-2282): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2288-2296): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2302-2310): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2316-2324): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2330-2338): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2344-2352): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2358-2366): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2372-2380): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2386-2394): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2400-2408): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2414-2422): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2428-2436): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2442-2450): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2456-2464): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2470-2478): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2484-2492): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2498-2506): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2512-2520): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2526-2534): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2540-2548): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2554-2562): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2568-2576): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2582-2590): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2596-2604): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2610-2618): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2624-2632): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2638-2646): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2652-2660): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2666-2674): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2680-2688): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2694-2702): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2708-2716): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2722-2730): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2736-2744): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2750-2758): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2764-2772): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2778-2786): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2792-2800): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2806-2814): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2820-2828): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2834-2842): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2848-2856): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2862-2870): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2876-2884): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2890-2898): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2904-2912): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2918-2926): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2932-2940): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2946-2954): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2960-2968): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2974-2982): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (2988-2996): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3002-3010): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3016-3024): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3030-3038): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3044-3052): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3058-3066): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3072-3080): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3086-3094): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3100-3108): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3114-3122): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3128-3136): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3142-3150): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3156-3164): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3170-3178): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3184-3192): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3198-3206): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3212-3220): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3226-3234): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3240-3248): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3254-3262): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3268-3276): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3282-3290): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3296-3304): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3310-3318): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3324-3332): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3338-3346): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3352-3360): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3366-3374): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3380-3388): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3394-3402): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3408-3416): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3422-3430): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3436-3444): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3450-3458): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3464-3472): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3478-3486): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3492-3500): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3506-3514): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3520-3528): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3534-3542): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3548-3556): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3562-3570): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3576-3584): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3590-3598): "continue" has to be in a "for" or "while" loop.
+// SyntaxError: (3604-3612): "continue" has to be in a "for" or "while" loop.
+// Warning: There are more than 256 errors. Aborting.
diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol
index c03fd97d..fd3067e3 100644
--- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol
+++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol
@@ -2,4 +2,4 @@ contract test {
uint256 ;
}
// ----
-// ParserError: Expected identifier, got 'Semicolon'
+// ParserError: (28-28): Expected identifier, got 'Semicolon'
diff --git a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol
index 2841fd38..dfd67aaa 100644
--- a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol
+++ b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol
@@ -3,4 +3,4 @@ contract test {
function fun() public { }
}
// ----
-// DeclarationError: Function with same name and arguments defined twice.
+// DeclarationError: (20-45): Function with same name and arguments defined twice.
diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol
index ea61d0f3..d90ec2d7 100644
--- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol
+++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
-// DeclarationError: Identifier already declared.
+// DeclarationError: (77-83): Identifier already declared.
diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol
index 22195963..06bfe7be 100644
--- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol
+++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol
@@ -6,5 +6,5 @@ contract test {
}
}
// ----
-// Warning: Unused local variable.
-// Warning: Unused local variable.
+// Warning: (87-93): Unused local variable.
+// Warning: (107-113): Unused local variable.
diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol
index 6af89c93..1a5ff2f9 100644
--- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol
+++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
-// DeclarationError: Identifier already declared.
+// DeclarationError: (75-81): Identifier already declared.
diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol
index 73cddfed..20ea0349 100644
--- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol
+++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol
@@ -6,5 +6,5 @@ contract test {
}
}
// ----
-// Warning: Unused local variable.
-// Warning: Unused local variable.
+// Warning: (87-93): Unused local variable.
+// Warning: (105-111): Unused local variable.
diff --git a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol
index d16877f9..67ada4a4 100644
--- a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol
+++ b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol
@@ -3,5 +3,4 @@ contract test {
function f() pure public { uint32 variable; variable = 2; }
}
// ----
-// Warning: This declaration shadows an existing declaration.
-
+// Warning: (69-84): This declaration shadows an existing declaration.
diff --git a/test/libsolidity/syntaxTests/scoping/scoping.sol b/test/libsolidity/syntaxTests/scoping/scoping.sol
index f47a3e99..34b055d9 100644
--- a/test/libsolidity/syntaxTests/scoping/scoping.sol
+++ b/test/libsolidity/syntaxTests/scoping/scoping.sol
@@ -8,4 +8,4 @@ contract test {
}
}
// ----
-// DeclarationError: Undeclared identifier.
+// DeclarationError: (123-124): Undeclared identifier.
diff --git a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol
index 0ed74a00..7334bc49 100644
--- a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol
+++ b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol
@@ -6,4 +6,4 @@ contract test {
}
}
// ----
-// DeclarationError: Undeclared identifier. Did you mean "x"?
+// DeclarationError: (85-86): Undeclared identifier. Did you mean "x"?
diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol
index 9bc7d569..1814cb47 100644
--- a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol
+++ b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol
@@ -8,4 +8,4 @@ contract test {
}
}
// ----
-// DeclarationError: Undeclared identifier.
+// DeclarationError: (154-155): Undeclared identifier.
diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol
index 07503983..3e80b385 100644
--- a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol
+++ b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol
@@ -7,4 +7,4 @@ contract test {
}
}
// ----
-// DeclarationError: Undeclared identifier.
+// DeclarationError: (93-94): Undeclared identifier.
diff --git a/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol b/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol
index e942020e..ab3dcefb 100644
--- a/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol
+++ b/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
-// DeclarationError: Undeclared identifier. Did you mean "a"?
+// DeclarationError: (94-95): Undeclared identifier. Did you mean "a"?
diff --git a/test/libsolidity/syntaxTests/smoke_test.sol b/test/libsolidity/syntaxTests/smoke_test.sol
index 2d48098a..6abaff18 100644
--- a/test/libsolidity/syntaxTests/smoke_test.sol
+++ b/test/libsolidity/syntaxTests/smoke_test.sol
@@ -3,4 +3,4 @@ contract test {
function fun(uint256 arg1) public { uint256 y; y = arg1; }
}
// ----
-// Warning: Function state mutability can be restricted to pure
+// Warning: (42-100): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol
index 9f57c3a4..c98d7a57 100644
--- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol
@@ -5,7 +5,7 @@ contract C {
}
}
// ----
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
+// TypeError: (74-83): This type cannot be encoded.
+// TypeError: (85-86): This type cannot be encoded.
+// TypeError: (88-98): This type cannot be encoded.
+// TypeError: (100-115): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol
index a7d13215..f1b5606e 100644
--- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol
@@ -6,8 +6,8 @@ contract C {
}
}
// ----
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
+// TypeError: (80-106): This type cannot be encoded.
+// TypeError: (108-113): This type cannot be encoded.
+// TypeError: (160-164): This type cannot be encoded.
+// TypeError: (166-168): This type cannot be encoded.
+// TypeError: (170-176): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
index 378155e9..cc354819 100644
--- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
@@ -9,6 +9,6 @@ contract C {
}
}
// ----
-// Warning: Defining empty structs is deprecated.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
+// Warning: (51-63): Defining empty structs is deprecated.
+// TypeError: (131-132): This type cannot be encoded.
+// TypeError: (134-135): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol
index 6e073fd8..d10c1718 100644
--- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol
@@ -9,9 +9,9 @@ contract C {
}
}
// ----
-// Warning: Defining empty structs is deprecated.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
-// TypeError: This type cannot be encoded.
+// Warning: (51-63): Defining empty structs is deprecated.
+// TypeError: (168-169): This type cannot be encoded.
+// TypeError: (171-172): This type cannot be encoded.
+// TypeError: (179-180): This type cannot be encoded.
+// TypeError: (182-186): This type cannot be encoded.
+// TypeError: (188-194): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol b/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol
index 9a1c22f1..895bb6c5 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol
@@ -12,4 +12,4 @@ contract C {
function f(T) public pure { }
}
// ----
-// Warning: Experimental features are turned on. Do not use experimental features on live deployments.
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol
index d4ad088d..96362ef0 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol
@@ -12,4 +12,4 @@ contract TestContract
function addTestStruct(TestStruct) public pure {}
}
// ----
-// Warning: Experimental features are turned on. Do not use experimental features on live deployments.
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol
index c02a8aa4..4966a731 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
-// TypeError: Internal or recursive type is not allowed for public or external functions.
+// TypeError: (91-92): Internal or recursive type is not allowed for public or external functions.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol
index e9488cf4..68113924 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
-// TypeError: Internal or recursive type is not allowed for public or external functions.
+// TypeError: (94-95): Internal or recursive type is not allowed for public or external functions.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol
index 6728baec..47690d9b 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
-// TypeError: Internal or recursive type is not allowed for public or external functions.
+// TypeError: (119-122): Internal or recursive type is not allowed for public or external functions.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol
index cac2e23f..bcffe383 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol
@@ -5,4 +5,4 @@ contract Test {
}
}
// ----
-// TypeError: Recursive struct definition.
+// TypeError: (20-93): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol
index 11fc6307..64dab8d0 100644
--- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol
@@ -9,4 +9,4 @@ contract Test {
}
}
// ----
-// TypeError: Recursive struct definition.
+// TypeError: (20-118): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol
index 7b9044dd..72ce3b40 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol
@@ -2,5 +2,5 @@ interface I {
function f();
}
// ----
-// Warning: Functions in interfaces should be declared external.
-// Warning: No visibility specified. Defaulting to "public". In interfaces it defaults to external.
+// Warning: (15-28): Functions in interfaces should be declared external.
+// Warning: (15-28): No visibility specified. Defaulting to "public". In interfaces it defaults to external.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol
index 127d4e92..513df26b 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol
@@ -3,5 +3,5 @@ interface I {
function f();
}
// ----
-// SyntaxError: No visibility specified.
-// TypeError: Functions in interfaces must be declared external.
+// SyntaxError: (45-58): No visibility specified.
+// TypeError: (45-58): Functions in interfaces must be declared external.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol
index a1cf5246..ac62e69b 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol
@@ -2,4 +2,4 @@ interface I {
function f() internal;
}
// ----
-// TypeError: Functions in interfaces cannot be internal or private.
+// TypeError: (15-37): Functions in interfaces cannot be internal or private.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol
index 887ebd4b..881e647e 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol
@@ -2,4 +2,4 @@ interface I {
function f() private;
}
// ----
-// TypeError: Functions in interfaces cannot be internal or private.
+// TypeError: (15-36): Functions in interfaces cannot be internal or private.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol
index 146d4f5b..891d9fdf 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol
@@ -2,4 +2,4 @@ interface I {
function f() public;
}
// ----
-// Warning: Functions in interfaces should be declared external. \ No newline at end of file
+// Warning: (15-35): Functions in interfaces should be declared external.
diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol
index f957f0b4..e0c04095 100644
--- a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol
+++ b/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol
@@ -3,4 +3,4 @@ interface I {
function f() public;
}
// ----
-// TypeError: Functions in interfaces must be declared external. \ No newline at end of file
+// TypeError: (45-65): Functions in interfaces must be declared external.
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index 07df8f60..7a147bd0 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -55,7 +55,6 @@ public:
{
Success,
Failure,
- InputOutputError,
Exception
};
@@ -90,11 +89,53 @@ string SyntaxTestTool::editor;
void SyntaxTestTool::printContract() const
{
- stringstream stream(m_test->source());
- string line;
- while (getline(stream, line))
- cout << " " << line << endl;
- cout << endl;
+ if (m_formatted)
+ {
+ string const& source = m_test->source();
+ if (source.empty())
+ return;
+
+ std::vector<char const*> sourceFormatting(source.length(), formatting::RESET);
+ for (auto const& error: m_test->errorList())
+ if (error.locationStart >= 0 && error.locationEnd >= 0)
+ {
+ assert(static_cast<size_t>(error.locationStart) < source.length());
+ assert(static_cast<size_t>(error.locationEnd) < source.length());
+ bool isWarning = error.type == "Warning";
+ for (int i = error.locationStart; i < error.locationEnd; i++)
+ if (isWarning)
+ {
+ if (sourceFormatting[i] == formatting::RESET)
+ sourceFormatting[i] = formatting::ORANGE_BACKGROUND;
+ }
+ else
+ sourceFormatting[i] = formatting::RED_BACKGROUND;
+ }
+
+ cout << " " << sourceFormatting.front() << source.front();
+ for (size_t i = 1; i < source.length(); i++)
+ {
+ if (sourceFormatting[i] != sourceFormatting[i - 1])
+ cout << sourceFormatting[i];
+ if (source[i] != '\n')
+ cout << source[i];
+ else
+ {
+ cout << formatting::RESET << endl;
+ if (i + 1 < source.length())
+ cout << " " << sourceFormatting[i];
+ }
+ }
+ cout << formatting::RESET << endl;
+ }
+ else
+ {
+ stringstream stream(m_test->source());
+ string line;
+ while (getline(stream, line))
+ cout << " " << line << endl;
+ cout << endl;
+ }
}
SyntaxTestTool::Result SyntaxTestTool::process()
@@ -107,15 +148,6 @@ SyntaxTestTool::Result SyntaxTestTool::process()
try
{
m_test = unique_ptr<SyntaxTest>(new SyntaxTest(m_path.string()));
- }
- catch (std::exception const& _e)
- {
- FormattedScope(cout, m_formatted, {BOLD, RED}) << "cannot read test: " << _e.what() << endl;
- return Result::InputOutputError;
- }
-
- try
- {
success = m_test->run(outputMessages, " ", m_formatted);
}
catch(CompilerError const& _e)
@@ -142,6 +174,11 @@ SyntaxTestTool::Result SyntaxTestTool::process()
"UnimplementedFeatureError: " << SyntaxTest::errorMessage(_e) << endl;
return Result::Exception;
}
+ catch (std::exception const& _e)
+ {
+ FormattedScope(cout, m_formatted, {BOLD, RED}) << "Exception: " << _e.what() << endl;
+ return Result::Exception;
+ }
catch(...)
{
FormattedScope(cout, m_formatted, {BOLD, RED}) <<
@@ -262,10 +299,6 @@ SyntaxTestStats SyntaxTestTool::processPath(
paths.pop();
++successCount;
break;
- default:
- // non-recoverable error; continue with next test case
- paths.pop();
- break;
}
}
}