aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/ReferencesResolver.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-18 20:53:45 +0800
committerGitHub <noreply@github.com>2017-10-18 20:53:45 +0800
commit9cf6e910bd2b90d0c9415d9c257f85fe0c518de8 (patch)
tree6423baec5e26bbe174005c1a89d978cae15015d8 /libsolidity/analysis/ReferencesResolver.cpp
parentbdeb9e52a2211510644fb53df93fb98258b40a65 (diff)
parentc85c41880ad1c996517b0ae14f98678b1e6c5613 (diff)
downloaddexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.gz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.bz2
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.lz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.xz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.zst
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.zip
Merge pull request #3099 from ethereum/develop
Merge develop into release for 0.4.18.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index 8f07d43a..f22c95cc 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -147,10 +147,12 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName)
if (Expression const* length = _typeName.length())
{
if (!length->annotation().type)
- ConstantEvaluator e(*length);
+ ConstantEvaluator e(*length, m_errorReporter);
auto const* lengthType = dynamic_cast<RationalNumberType const*>(length->annotation().type.get());
- if (!lengthType || lengthType->isFractional())
+ if (!lengthType || !lengthType->mobileType())
fatalTypeError(length->location(), "Invalid array length, expected integer literal.");
+ else if (lengthType->isFractional())
+ fatalTypeError(length->location(), "Array with fractional length specified.");
else if (lengthType->isNegative())
fatalTypeError(length->location(), "Array with negative length specified.");
else
@@ -296,11 +298,19 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
{
typeLoc = DataLocation::Storage;
if (_variable.isLocalVariable())
- m_errorReporter.warning(
- _variable.location(),
- "Variable is declared as a storage pointer. "
- "Use an explicit \"storage\" keyword to silence this warning."
- );
+ {
+ if (_variable.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050))
+ typeError(
+ _variable.location(),
+ "Storage location must be specified as either \"memory\" or \"storage\"."
+ );
+ else
+ m_errorReporter.warning(
+ _variable.location(),
+ "Variable is declared as a storage pointer. "
+ "Use an explicit \"storage\" keyword to silence this warning."
+ );
+ }
}
}
else
@@ -347,4 +357,3 @@ void ReferencesResolver::fatalDeclarationError(SourceLocation const& _location,
m_errorOccurred = true;
m_errorReporter.fatalDeclarationError(_location, _description);
}
-