New Issue: Catching a deprecated Error subclass results in two deprecation warnings instead of one for the same line

19304, "lydia-duncan", "Catching a deprecated Error subclass results in two deprecation warnings instead of one for the same line", "2022-02-24T17:46:37Z"

Summary of Problem

Our try-catch structure in the compiler results in two references to the caught error subtype. Both instances trigger the deprecation warning, even though the user only wrote the symbol once. The user should not have to see two messages for a single reference to a deprecated symbol

Steps to Reproduce

Source Code:

deprecated
class MyDepErr : Error {
}

proc throwsDepErr() throws {
  throw new MyDepErr();
}

proc main() {
  try {
    throwsDepErr();
  } catch (e: MyDepErr) {
    writeln(e.type: string);
  } catch {
    writeln("whatever");
  }
}

Compile command:
chpl foo.chpl

Results in:

foo.chpl:5: In function 'throwsDepErr':
foo.chpl:6: warning: anymanaged MyDepErr is deprecated
foo.chpl:9: In function 'main':
foo.chpl:12: warning: anymanaged MyDepErr is deprecated
foo.chpl:12: warning: anymanaged MyDepErr is deprecated

Associated Future Test(s):
TBA

Configuration Information

  • Output of chpl --version: chapel 1.26.0 (pre-release)
  • Output of $CHPL_HOME/util/printchplenv --anonymize: N/A
  • Back-end compiler and version, e.g. gcc --version or clang --version: N/A
  • (For Cray systems only) Output of module list: N/A