[flang] Address review comment
authorpeter klausler <pklausler@nvidia.com>
Sat, 9 Mar 2019 18:24:27 +0000 (10:24 -0800)
committerpeter klausler <pklausler@nvidia.com>
Sat, 9 Mar 2019 18:25:08 +0000 (10:25 -0800)
Original-commit: flang-compiler/f18@8a9a41487e809e61b173b07f629a8e0251a8b921
Reviewed-on: https://github.com/flang-compiler/f18/pull/322

flang/lib/semantics/expression.cc

index ec70d44..ac84ce0 100644 (file)
@@ -322,16 +322,13 @@ static void FixMisparsedSubstring(const parser::Designator &d) {
                     },
                     arrElement.base.u)}) {
               const Symbol &ultimate{symbol->GetUltimate()};
-              if (const auto *details{
-                      ultimate.detailsIf<semantics::ObjectEntityDetails>()}) {
-                if (const semantics::DeclTypeSpec * type{details->type()}) {
-                  if (!details->IsArray() &&
-                      type->category() == semantics::DeclTypeSpec::Character) {
-                    // The ambiguous S(j:k) was parsed as an array section
-                    // reference, but it's now clear that it's a substring.
-                    // Fix the parse tree in situ.
-                    mutate.u = arrElement.ConvertToSubstring();
-                  }
+              if (const semantics::DeclTypeSpec *type{ultimate.GetType()}) {
+                if (!ultimate.IsObjectArray() &&
+                    type->category() == semantics::DeclTypeSpec::Character) {
+                  // The ambiguous S(j:k) was parsed as an array section
+                  // reference, but it's now clear that it's a substring.
+                  // Fix the parse tree in situ.
+                  mutate.u = arrElement.ConvertToSubstring();
                 }
               }
             }