Turn unreachable error into assertion

This commit is contained in:
Alex Beregszaszi
2021-02-16 10:59:22 +00:00
parent 3c4ef23809
commit ded5d721d2
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -530,10 +530,11 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT
bool found = false;
if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name))
{
// Check that it is a variable
if (!holds_alternative<Scope::Variable>(*var))
m_errorReporter.typeError(2657_error, _variable.location, "Assignment requires variable.");
else if (!m_activeVariables.count(&std::get<Scope::Variable>(*var)))
// Check that it is a variable.
// This can also hold a function, but that is caught by error 6041.
yulAssert(holds_alternative<Scope::Variable>(*var), "Assignment requires variable.");
if (!m_activeVariables.count(&std::get<Scope::Variable>(*var)))
m_errorReporter.declarationError(
1133_error,
_variable.location,