Properly use AST node name also for secondary location.

This commit is contained in:
chriseth 2021-06-10 14:38:45 +02:00
parent a4f2e591fe
commit cf00faca33
2 changed files with 12 additions and 21 deletions

View File

@ -661,23 +661,21 @@ void OverrideChecker::overrideListError(
); );
} }
void OverrideChecker::overrideError(Declaration const& _overriding, Declaration const& _super, ErrorId _error, string const& _message, string const& _secondaryMsg) void OverrideChecker::overrideError(
OverrideProxy const& _overriding,
OverrideProxy const& _super,
ErrorId _error,
string const& _message,
optional<string> const& _secondaryMsg
)
{ {
m_errorReporter.typeError( m_errorReporter.typeError(
_error, _error,
_overriding.location(), _overriding.location(),
SecondarySourceLocation().append(_secondaryMsg, _super.location()), SecondarySourceLocation().append(
_message _secondaryMsg.value_or("Overridden " + _super.astNodeName() + " is here:"),
); _super.location()
} ),
void OverrideChecker::overrideError(OverrideProxy const& _overriding, OverrideProxy const& _super, ErrorId _error, string const& _message, string const& _secondaryMsg)
{
m_errorReporter.typeError(
_error,
_overriding.location(),
SecondarySourceLocation().append(_secondaryMsg, _super.location()),
_message _message
); );
} }

View File

@ -166,19 +166,12 @@ private:
std::string const& _message1, std::string const& _message1,
std::string const& _message2 std::string const& _message2
); );
void overrideError(
Declaration const& _overriding,
Declaration const& _super,
langutil::ErrorId _error,
std::string const& _message,
std::string const& _secondaryMsg = "Overridden function is here:"
);
void overrideError( void overrideError(
OverrideProxy const& _overriding, OverrideProxy const& _overriding,
OverrideProxy const& _super, OverrideProxy const& _super,
langutil::ErrorId _error, langutil::ErrorId _error,
std::string const& _message, std::string const& _message,
std::string const& _secondaryMsg = "Overridden function is here:" std::optional<std::string> const& _secondaryMsg = {}
); );
/// Checks for functions in different base contracts which conflict with each /// Checks for functions in different base contracts which conflict with each
/// other and thus need to be overridden explicitly. /// other and thus need to be overridden explicitly.