aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-12-02 09:01:55 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-12-11 10:34:42 +0800
commite9d256ddf4322050f9b834abd3400f1cb5377f68 (patch)
tree6d4fca6a46240f2d2ac44a138163f63ae88050cd /libsolidity
parent226bfe5be1f7443e644d2cfd62aac19b56836b8a (diff)
downloaddexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.tar.gz
dexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.tar.zst
dexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.zip
Suggest the experimental ABI encoder if using structs as function parameters
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 96160a75..daa5471a 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -570,6 +570,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
m_errorReporter.typeError(var->location(), "Type is required to live outside storage.");
if (_function.visibility() >= FunctionDefinition::Visibility::Public && !(type(*var)->interfaceType(isLibraryFunction)))
m_errorReporter.fatalTypeError(var->location(), "Internal or recursive type is not allowed for public or external functions.");
+ if (
+ _function.visibility() > FunctionDefinition::Visibility::Internal &&
+ type(*var)->category() == Type::Category::Struct &&
+ !_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2)
+ )
+ m_errorReporter.typeError(
+ var->location(),
+ "Structs are only supported in the new experimental ABI encoder. "
+ "Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
+ );
var->accept(*this);
}