[Chapel Merge] Various procedure pointer fixes

Branch: refs/heads/main
Revision: 74e2e16d9ccdf541287d1e04f0351c275c9587c8
Author: benharsh
Link: Various procedure pointer fixes by benharsh · Pull Request #28847 · chapel-lang/chapel · GitHub
Log Message:
Various procedure pointer fixes (#28847)

This PR includes a few fixes that improve the state of procedure
pointers:

  • implement proper casting of procedure pointers to strings (which
    prints the proc's name)
  • allow procedure pointers to return types that normally need to return
    via an argument
  • implement implicit coercion of actuals by wrapping each invocation of
    a procedure pointer in a wrapper
  • this allows us to more easily re-use code in 'wrappers.cpp' without a
    huge refactor.
    • this wrapper is immediately removed except in the case of promotion
  • move codegen of class prototypes to be before function types, which
    helps prevent recursion
  • fixes an issue with denormalization of procedure pointer temporaries

[reviewed-by @dlongnecke-cray]

Compare: Comparing f268dede1e432429dfc893336972b76d6df57b8f...3f28e69db13994b70027101120cb9db55b85d55b · chapel-lang/chapel · GitHub

Diff:
M compiler/codegen/codegen.cpp
M compiler/passes/denormalize.cpp
M compiler/resolution/callDestructors.cpp
M compiler/resolution/functionResolution.cpp
M modules/standard/ChapelIO.chpl
A test/functions/fcf/pointers/TestCoercions.chpl
A test/functions/fcf/pointers/TestCoercions.good
A test/functions/fcf/pointers/TestPromotion.chpl
A test/functions/fcf/pointers/TestPromotion.good
https://github.com/chapel-lang/chapel/pull/28847.diff