[flang] Simply the test per review comment.
authorEric Schweitz <eschweitz@nvidia.com>
Fri, 22 Mar 2019 22:39:51 +0000 (15:39 -0700)
committerEric Schweitz <eschweitz@nvidia.com>
Fri, 22 Mar 2019 22:39:51 +0000 (15:39 -0700)
Original-commit: flang-compiler/f18@66ab8bb2aaf43edd6b6351c85b255d354f85345c
Reviewed-on: https://github.com/flang-compiler/f18/pull/351

flang/lib/semantics/check-do-concurrent.cc

index c5995f6..51c1275 100644 (file)
@@ -450,35 +450,8 @@ public:
 private:
   bool ExpressionHasTypeCategory(const evaluate::GenericExprWrapper &expr,
       const common::TypeCategory &type) {
-    return std::visit(
-        common::visitors{
-            [](auto &) { return false; },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Integer>> &) {
-              return type == common::TypeCategory::Integer;
-            },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Real>> &) {
-              return type == common::TypeCategory::Real;
-            },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Complex>> &) {
-              return type == common::TypeCategory::Complex;
-            },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Character>> &) {
-              return type == common::TypeCategory::Character;
-            },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Logical>> &) {
-              return type == common::TypeCategory::Logical;
-            },
-            [=](const evaluate::Expr<
-                evaluate::SomeKind<common::TypeCategory::Derived>> &) {
-              return type == common::TypeCategory::Derived;
-            },
-        },
-        expr.v.u);
+    auto dynamicType{expr.v.GetType()};
+    return dynamicType.has_value() && dynamicType->category == type;
   }
   bool InnermostEnclosingScope(const semantics::Symbol &symbol) const {
     // TODO - implement