aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/abi-spec.rst12
-rw-r--r--docs/index.rst4
-rw-r--r--docs/style-guide.rst4
-rw-r--r--docs/types.rst2
-rw-r--r--docs/units-and-global-variables.rst5
-rw-r--r--libsolidity/analysis/PostTypeChecker.h2
-rw-r--r--libsolidity/analysis/StaticAnalyzer.h2
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp2
-rw-r--r--libsolidity/analysis/SyntaxChecker.h2
-rw-r--r--libsolidity/analysis/TypeChecker.h2
-rw-r--r--libsolidity/ast/ASTPrinter.cpp12
-rw-r--r--libsolidity/ast/ASTPrinter.h2
-rw-r--r--libsolidity/ast/Types.cpp2
-rw-r--r--libsolidity/ast/Types.h4
-rw-r--r--libsolidity/codegen/ABIFunctions.cpp4
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp2
-rwxr-xr-xscripts/install_deps.sh7
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp29
18 files changed, 69 insertions, 30 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 43757d24..77d15026 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -130,14 +130,14 @@ on the type of ``X`` being
Note that in the dynamic case, ``head(X(i))`` is well-defined since the lengths of
the head parts only depend on the types and not the values. Its value is the offset
of the beginning of ``tail(X(i))`` relative to the start of ``enc(X)``.
-
+
- ``T[k]`` for any ``T`` and ``k``:
``enc(X) = enc((X[0], ..., X[k-1]))``
-
+
i.e. it is encoded as if it were a tuple with ``k`` elements
of the same type.
-
+
- ``T[]`` where ``X`` has ``k`` elements (``k`` is assumed to be of type ``uint256``):
``enc(X) = enc(k) enc([X[1], ..., X[k]])``
@@ -326,7 +326,7 @@ An event description is a JSON object with fairly similar fields:
- ``anonymous``: ``true`` if the event was declared as ``anonymous``.
-For example,
+For example,
::
@@ -334,8 +334,8 @@ For example,
contract Test {
function Test(){ b = 0x12345678901234567890123456789012; }
- event Event(uint indexed a, bytes32 b)
- event Event2(uint indexed a, bytes32 b)
+ event Event(uint indexed a, bytes32 b);
+ event Event2(uint indexed a, bytes32 b);
function foo(uint a) { Event(a, b); }
bytes32 b;
}
diff --git a/docs/index.rst b/docs/index.rst
index 351f8ad7..14350043 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -6,8 +6,8 @@ Solidity
:alt: Solidity logo
:align: center
-Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript
-and it is designed to target the Ethereum Virtual Machine (EVM).
+Solidity is a contract-oriented, high-level language for implementing smart contracts.
+The syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine (EVM).
Solidity is statically typed, supports inheritance, libraries and complex
user-defined types among other features.
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 66fae0c4..a438b3d0 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -25,7 +25,7 @@ solidity code. The goal of this guide is *consistency*. A quote from python's
captures this concept well.
A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important.
- But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!
+ But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgement. Look at other examples and decide what looks best. And don't hesitate to ask!
***********
@@ -223,7 +223,7 @@ Whitespace in Expressions
Avoid extraneous whitespace in the following situations:
-Immediately inside parenthesis, brackets or braces, with the exception of single-line function declarations.
+Immediately inside parenthesis, brackets or braces, with the exception of single line function declarations.
Yes::
diff --git a/docs/types.rst b/docs/types.rst
index 774c1d04..0be8255e 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -129,7 +129,7 @@ and to send Ether (in units of wei) to an address using the ``transfer`` functio
if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10);
.. note::
- If ``x`` is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the ``transfer`` call (this is a limitation of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted and the current contract will stop with an exception.
+ If ``x`` is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the ``transfer`` call (this is a feature of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted and the current contract will stop with an exception.
* ``send``
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 7af97376..8261bdde 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -85,11 +85,6 @@ Block and Transaction Properties
consecutive blocks in the canonical chain.
.. note::
- If you want to implement access restrictions in library functions using
- ``msg.sender``, you have to manually supply the value of
- ``msg.sender`` as an argument.
-
-.. note::
The block hashes are not available for all blocks for scalability reasons.
You can only access the hashes of the most recent 256 blocks, all other
values will be zero.
diff --git a/libsolidity/analysis/PostTypeChecker.h b/libsolidity/analysis/PostTypeChecker.h
index 91d2b0b9..bafc1ae6 100644
--- a/libsolidity/analysis/PostTypeChecker.h
+++ b/libsolidity/analysis/PostTypeChecker.h
@@ -38,7 +38,7 @@ class ErrorReporter;
class PostTypeChecker: private ASTConstVisitor
{
public:
- /// @param _errors the reference to the list of errors and warnings to add them found during type checking.
+ /// @param _errorReporter provides the error logging functionality.
PostTypeChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool check(ASTNode const& _astRoot);
diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h
index 24ed119f..124c4e7c 100644
--- a/libsolidity/analysis/StaticAnalyzer.h
+++ b/libsolidity/analysis/StaticAnalyzer.h
@@ -43,7 +43,7 @@ namespace solidity
class StaticAnalyzer: private ASTConstVisitor
{
public:
- /// @param _errors the reference to the list of errors and warnings to add them found during static analysis.
+ /// @param _errorReporter provides the error logging functionality.
explicit StaticAnalyzer(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
/// Performs static analysis on the given source unit and all of its sub-nodes.
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index 0ca4b86c..b6cc04da 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -54,7 +54,7 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
string(".") +
to_string(recommendedVersion.minor()) +
string(".") +
- to_string(recommendedVersion.patch());
+ to_string(recommendedVersion.patch()) +
string(";\"");
m_errorReporter.warning(_sourceUnit.location(), errorString);
diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h
index 7fffbec0..d5d72f14 100644
--- a/libsolidity/analysis/SyntaxChecker.h
+++ b/libsolidity/analysis/SyntaxChecker.h
@@ -38,7 +38,7 @@ namespace solidity
class SyntaxChecker: private ASTConstVisitor
{
public:
- /// @param _errors the reference to the list of errors and warnings to add them found during type checking.
+ /// @param _errorReporter provides the error logging functionality.
SyntaxChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool checkSyntax(ASTNode const& _astRoot);
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index abe6dac1..344b019d 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -42,7 +42,7 @@ class ErrorReporter;
class TypeChecker: private ASTConstVisitor
{
public:
- /// @param _errors the reference to the list of errors and warnings to add them found during type checking.
+ /// @param _errorReporter provides the error logging functionality.
TypeChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
/// Performs type checking on the given contract and all of its sub-nodes.
diff --git a/libsolidity/ast/ASTPrinter.cpp b/libsolidity/ast/ASTPrinter.cpp
index 81e6cc44..23c3cbe1 100644
--- a/libsolidity/ast/ASTPrinter.cpp
+++ b/libsolidity/ast/ASTPrinter.cpp
@@ -78,6 +78,13 @@ bool ASTPrinter::visit(InheritanceSpecifier const& _node)
return goDeeper();
}
+bool ASTPrinter::visit(UsingForDirective const& _node)
+{
+ writeLine("UsingForDirective");
+ printSourcePart(_node);
+ return goDeeper();
+}
+
bool ASTPrinter::visit(StructDefinition const& _node)
{
writeLine("StructDefinition \"" + _node.name() + "\"");
@@ -385,6 +392,11 @@ void ASTPrinter::endVisit(InheritanceSpecifier const&)
m_indentation--;
}
+void ASTPrinter::endVisit(UsingForDirective const&)
+{
+ m_indentation--;
+}
+
void ASTPrinter::endVisit(StructDefinition const&)
{
m_indentation--;
diff --git a/libsolidity/ast/ASTPrinter.h b/libsolidity/ast/ASTPrinter.h
index d6897dfd..01e4f7fc 100644
--- a/libsolidity/ast/ASTPrinter.h
+++ b/libsolidity/ast/ASTPrinter.h
@@ -51,6 +51,7 @@ public:
bool visit(ImportDirective const& _node) override;
bool visit(ContractDefinition const& _node) override;
bool visit(InheritanceSpecifier const& _node) override;
+ bool visit(UsingForDirective const& _node) override;
bool visit(StructDefinition const& _node) override;
bool visit(EnumDefinition const& _node) override;
bool visit(EnumValue const& _node) override;
@@ -94,6 +95,7 @@ public:
void endVisit(ImportDirective const&) override;
void endVisit(ContractDefinition const&) override;
void endVisit(InheritanceSpecifier const&) override;
+ void endVisit(UsingForDirective const&) override;
void endVisit(StructDefinition const&) override;
void endVisit(EnumDefinition const&) override;
void endVisit(EnumValue const&) override;
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index ee5f462b..21daac2c 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2574,7 +2574,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
"selector",
make_shared<FixedBytesType>(4)
));
- if (m_kind != Kind::BareDelegateCall && m_kind != Kind::DelegateCall)
+ if (m_kind != Kind::BareDelegateCall)
{
if (isPayable())
members.push_back(MemberList::Member(
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index ce29975e..635279ab 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -707,10 +707,6 @@ public:
/// Returns the function type of the constructor modified to return an object of the contract's type.
FunctionTypePointer const& newExpressionType() const;
- /// @returns the identifier of the function with the given name or Invalid256 if such a name does
- /// not exist.
- u256 functionIdentifier(std::string const& _functionName) const;
-
/// @returns a list of all state variables (including inherited) of the contract and their
/// offsets in storage.
std::vector<std::tuple<VariableDeclaration const*, u256, unsigned>> stateVariables() const;
diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp
index 080be359..d2cbac99 100644
--- a/libsolidity/codegen/ABIFunctions.cpp
+++ b/libsolidity/codegen/ABIFunctions.cpp
@@ -483,7 +483,7 @@ string ABIFunctions::abiEncodingFunctionCalldataArray(
_to.identifier() +
(_encodeAsLibraryTypes ? "_library" : "");
return createFunction(functionName, [&]() {
- solUnimplementedAssert(fromArrayType.isByteArray(), "");
+ solUnimplementedAssert(fromArrayType.isByteArray(), "Only byte arrays can be encoded from calldata currently.");
// TODO if this is not a byte array, we might just copy byte-by-byte anyway,
// because the encoding is position-independent, but we have to check that.
Whiskers templ(R"(
@@ -754,7 +754,7 @@ string ABIFunctions::abiEncodingFunctionStruct(
_to.identifier() +
(_encodeAsLibraryTypes ? "_library" : "");
- solUnimplementedAssert(!_from.dataStoredIn(DataLocation::CallData), "");
+ solUnimplementedAssert(!_from.dataStoredIn(DataLocation::CallData), "Encoding struct from calldata is not yet supported.");
solAssert(&_from.structDefinition() == &_to.structDefinition(), "");
return createFunction(functionName, [&]() {
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index f9b181ae..053bed6a 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -121,7 +121,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound
{
if (auto ref = dynamic_cast<ReferenceType const*>(&_type))
{
- solUnimplementedAssert(ref->location() == DataLocation::Memory, "");
+ solUnimplementedAssert(ref->location() == DataLocation::Memory, "Only in-memory reference type can be stored.");
storeInMemoryDynamic(IntegerType(256), _padToWordBoundaries);
}
else if (auto str = dynamic_cast<StringLiteralType const*>(&_type))
diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh
index 49f864a0..15e864b5 100755
--- a/scripts/install_deps.sh
+++ b/scripts/install_deps.sh
@@ -294,12 +294,17 @@ case $(uname -s) in
echo "Installing solidity dependencies on Ubuntu Zesty (17.04)."
install_z3="libz3-dev"
;;
+ artful)
+ #artful
+ echo "Installing solidity dependencies on Ubuntu Artful (17.10)."
+ install_z3="libz3-dev"
+ ;;
*)
#other Ubuntu
echo "ERROR - Unknown or unsupported Ubuntu version (" $(lsb_release -cs) ")"
echo "ERROR - This might not work, but we are trying anyway."
echo "Please drop us a message at https://gitter.im/ethereum/solidity-dev."
- echo "We only support Trusty, Utopic, Vivid, Wily, Xenial and Yakkety."
+ echo "We only support Trusty, Utopic, Vivid, Wily, Xenial, Yakkety, Zesty and Artful."
install_z3="libz3-dev"
;;
esac
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index e5990e9b..30624260 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -4036,6 +4036,35 @@ BOOST_AUTO_TEST_CASE(varM_disqualified_as_keyword)
BOOST_CHECK(!success(text));
}
+BOOST_AUTO_TEST_CASE(modifier_is_not_a_valid_typename)
+{
+ char const* text = R"(
+ contract test {
+ modifier mod() { _; }
+
+ function f() public {
+ mod g;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Name has to refer to a struct, enum or contract.");
+}
+
+BOOST_AUTO_TEST_CASE(function_is_not_a_valid_typename)
+{
+ char const* text = R"(
+ contract test {
+ function foo() public {
+ }
+
+ function f() public {
+ foo g;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Name has to refer to a struct, enum or contract.");
+}
+
BOOST_AUTO_TEST_CASE(long_uint_variable_fails)
{
char const* text = R"(