forked from OSchip/llvm-project
[flang] Improve error message (add types)
Original-commit: flang-compiler/f18@48b8f32d51 Reviewed-on: https://github.com/flang-compiler/f18/pull/738 Tree-same-pre-rewrite: false
This commit is contained in:
parent
ea7652a251
commit
c93ceeeef7
|
@ -497,8 +497,16 @@ std::optional<Expr<LogicalResult>> Relate(parser::ContextualMessages &messages,
|
|||
// Default case
|
||||
[&](auto &&, auto &&) {
|
||||
// TODO: defined operator
|
||||
messages.Say(
|
||||
"relational operands do not have comparable types"_err_en_US);
|
||||
auto xtype{x.GetType()};
|
||||
auto ytype{y.GetType()};
|
||||
if (xtype.has_value() && ytype.has_value()) {
|
||||
messages.Say(
|
||||
"Relational operands do not have comparable types (%s vs. %s)"_err_en_US,
|
||||
xtype->AsFortran(), ytype->AsFortran());
|
||||
} else {
|
||||
messages.Say(
|
||||
"Relational operands do not have comparable types"_err_en_US);
|
||||
}
|
||||
return std::optional<Expr<LogicalResult>>{};
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue