[Chapel Merge] Dyno: fix enumToOrder for enums declared in internal modules

Branch: refs/heads/main
Revision: 65c0c9d89d93a57c51fa4310ba83e36244942fb7
Author: DanilaFe
Link: Dyno: fix enumToOrder for enums declared in internal modules by DanilaFe · Pull Request #27583 · chapel-lang/chapel · GitHub
Log Message:
Dyno: fix enumToOrder for enums declared in internal modules (#27583)

Closes https://github.com/Cray/chapel-private/issues/7402.

The following code now resolves fine in --dyno-resolve-only:

proc main() {
  var m = memoryOrder.seqCst;
  writeln(chpl__enumToOrder(m));
}

The issue was that internal modules don't auto-use ChapelBase.

As a result, they don't have access to ==. In production this doesn't
come up because chpl__enumToOrder gets placed into ChapelBase (?!).
In Dyno, we can't do this. Instead, this PR inserts a use statement
into chpl__enumToOrder to simulate having access to the necessary
methods etc.

Testing

  • dyno tests
  • code in this PR's OP / issue 7402 now resolves
  • paratest --dyno-resolve-only
  • paratest

Reviewed by @benharsh -- thanks!

Compare: Comparing f200e55304f104bdeb0d613b8cd1f2fce0771260...499b0f7c9334aed3bb0fbfddead0fbe1b8994539 · chapel-lang/chapel · GitHub

Diff:
M frontend/lib/resolution/default-functions.cpp
M frontend/test/resolution/testEnums.cpp
https://github.com/chapel-lang/chapel/pull/27583.diff