diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-04 01:30:31 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-06 20:48:38 +0800 |
commit | c45e55675c57459d800391579e993975e3ad0291 (patch) | |
tree | f30d08023bd2fb39f12cebae7c75641e5386e260 /libsolidity/analysis | |
parent | 094012dbb046655ac0291f6c4632f306406c0ada (diff) | |
download | dexon-solidity-c45e55675c57459d800391579e993975e3ad0291.tar.gz dexon-solidity-c45e55675c57459d800391579e993975e3ad0291.tar.zst dexon-solidity-c45e55675c57459d800391579e993975e3ad0291.zip |
Force interface functions as external (0.5.0)
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index b2a88059..c2fba565 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -595,8 +595,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function) { if (_function.isImplemented()) m_errorReporter.typeError(_function.location(), "Functions in interfaces cannot have an implementation."); - if (_function.visibility() < FunctionDefinition::Visibility::Public) - m_errorReporter.typeError(_function.location(), "Functions in interfaces cannot be internal or private."); + if (_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050)) + { + if (_function.visibility() != FunctionDefinition::Visibility::External) + m_errorReporter.typeError(_function.location(), "Functions in interfaces must be declared external."); + } + else + { + if (_function.visibility() < FunctionDefinition::Visibility::Public) + m_errorReporter.typeError(_function.location(), "Functions in interfaces cannot be internal or private."); + } if (_function.isConstructor()) m_errorReporter.typeError(_function.location(), "Constructor cannot be defined in interfaces."); } |