aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-03-06 22:05:58 +0800
committerGitHub <noreply@github.com>2017-03-06 22:05:58 +0800
commit2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0 (patch)
treec90805051b690b04c36bb0db87f86998f55c0aa3 /libsolidity/analysis
parent573b885337aca75a025c08eea80bb109041e669e (diff)
parentc126edc6ea1c7af4d0a43e9d36a958f157d9b35c (diff)
downloaddexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar.gz
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar.bz2
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar.lz
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar.xz
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.tar.zst
dexon-solidity-2fcccb97d393cfc6eb5120029d1ec2d6526c0bd0.zip
Merge pull request #1737 from ethereum/localmappings
Disallow uninitialized mapping variables.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 5426cd17..ee970e5d 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -730,13 +730,16 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
if (auto ref = dynamic_cast<ReferenceType const*>(type(varDecl).get()))
{
if (ref->dataStoredIn(DataLocation::Storage))
- {
warning(
varDecl.location(),
"Uninitialized storage pointer. Did you mean '<type> memory " + varDecl.name() + "'?"
);
- }
}
+ else if (dynamic_cast<MappingType const*>(type(varDecl).get()))
+ typeError(
+ varDecl.location(),
+ "Uninitialized mapping. Mappings cannot be created dynamically, you have to assign them from a state variable."
+ );
varDecl.accept(*this);
return false;
}