[all-commits] [llvm/llvm-project] 112fb2: [flang] Improve error for data component definitio...

mleair via All-commits all-commits at lists.llvm.org
Thu Jun 11 15:10:53 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 112fb2f79d7983be203957cad6b148865182ed47
      https://github.com/llvm/llvm-project/commit/112fb2f79d7983be203957cad6b148865182ed47
  Author: mleair <leairmark at gmail.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M flang/lib/Parser/Fortran-parsers.cpp
    A flang/test/Parser/recovery09.f90

  Log Message:
  -----------
  [flang] Improve error for data component definition after CONTAINS in derived type (#203379)

When a data component declaration appears after CONTAINS in a derived
type definition, flang previously emitted confusing "expected 'FINAL'",
  "expected 'GENERIC'", and "expected 'PROCEDURE'" errors for each
  misplaced component.

   This patch adds a misplaced-component detector following the same
  pattern as `misplacedSpecificationStmt` in program-parsers.cpp.
  DataComponentDefStmt is tried as a last alternative in
  TypeBoundProcBinding's first(). When it matches, fail<>() fires
  with the message:

    error: component definition must precede CONTAINS in a derived type

  CombineFailedParses then replaces the three keyword-mismatch messages
  with this single targeted one, since the component parse advances
  further than the PROCEDURE/GENERIC/FINAL failures.

  Assisted-By: AI



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list