[flang] Always resolve associate-name in select-type
authorTim Keith <tkeith@nvidia.com>
Sat, 9 Feb 2019 00:17:52 +0000 (16:17 -0800)
committerTim Keith <tkeith@nvidia.com>
Sat, 9 Feb 2019 00:17:52 +0000 (16:17 -0800)
Even if the selector expression has an error, we can resolve the
associate-name.

Original-commit: flang-compiler/f18@3c35c30f581b2ef0d7d74af8fddfc4adaba9d6c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false

flang/lib/semantics/resolve-names.cc

index d6390b4..0d336c0 100644 (file)
@@ -3493,9 +3493,6 @@ void ConstructVisitor::Post(const parser::Association &x) {
 }
 
 void ConstructVisitor::Post(const parser::SelectTypeStmt &x) {
-  if (!association_.expr) {
-    return;  // reported error in expression evaluation
-  }
   if (const std::optional<parser::Name> &name{std::get<1>(x.t)}) {
     // This isn't a name in the current scope, it is in each TypeGuardStmt
     MakePlaceholder(*name, MiscDetails::Kind::SelectTypeAssociateName);
@@ -3503,7 +3500,6 @@ void ConstructVisitor::Post(const parser::SelectTypeStmt &x) {
   } else if (!association_.variable) {
     Say("Selector is not a named variable: 'associate-name =>' is required"_err_en_US);
     association_ = {};
-    return;
   }
 }