From e434437eb71e03483232a55aac8c53928fe63d38 Mon Sep 17 00:00:00 2001 From: Rhett Aultman Date: Wed, 20 Sep 2017 11:52:10 -0400 Subject: Unary + now a synax error (experimental 0.5.0) The unary + was deprecated with a warning, but will be elevated to an error in 0.5.0. This adds the syntax error for the 0.5.0 pragma, and for a true 0.5.0 release we should consider removing the operator from the parser. --- libsolidity/analysis/SyntaxChecker.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libsolidity/analysis/SyntaxChecker.cpp') diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 187eb26f..0ca4b86c 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -182,8 +182,15 @@ bool SyntaxChecker::visit(Throw const& _throwStatement) bool SyntaxChecker::visit(UnaryOperation const& _operation) { + bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050); + if (_operation.getOperator() == Token::Add) - m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated."); + { + if (v050) + m_errorReporter.syntaxError(_operation.location(), "Use of unary + is deprecated."); + else + m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated."); + } return true; } -- cgit v1.2.3