diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 225735bac..4b1f28cda 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -287,8 +287,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor) bool TypeChecker::visit(StructDefinition const& _struct) { for (ASTPointer const& member: _struct.members()) - if (!type(*member)->canBeStored()) - m_errorReporter.typeError(member->location(), "Type cannot be used in struct."); + solAssert(type(*member)->canBeStored(), "Type cannot be used in struct."); // Check recursion, fatal error if detected. auto visitor = [&](StructDefinition const& _struct, CycleDetector& _cycleDetector, size_t _depth) @@ -615,8 +614,7 @@ void TypeChecker::endVisit(FunctionTypeName const& _funType) { FunctionType const& fun = dynamic_cast(*_funType.annotation().type); if (fun.kind() == FunctionType::Kind::External) - if (!fun.canBeUsedExternally(false)) - m_errorReporter.typeError(_funType.location(), "External function type uses internal types."); + solAssert(fun.canBeUsedExternally(false), "External function type uses internal types."); } bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) @@ -887,8 +885,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) if (ref->dataStoredIn(DataLocation::Storage)) { string errorText{"Uninitialized storage pointer."}; - if (varDecl.referenceLocation() == VariableDeclaration::Location::Unspecified) - errorText += " Did you mean ' memory " + varDecl.name() + "'?"; + solAssert(varDecl.referenceLocation() != VariableDeclaration::Location::Unspecified, "Expected a specified location at this point"); solAssert(m_scope, ""); m_errorReporter.declarationError(varDecl.location(), errorText); } @@ -956,10 +953,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) solAssert(false, ""); } else if (*var.annotation().type == TupleType()) - m_errorReporter.typeError( - var.location(), - "Cannot declare variable with void (empty tuple) type." - ); + solAssert(false, "Cannot declare variable with void (empty tuple) type."); else if (valueComponentType->category() == Type::Category::RationalNumber) { string typeName = var.annotation().type->toString(true);