chapel icon indicating copy to clipboard operation
chapel copied to clipboard

Compiler fails to resolve promoted call from another module

Open jabraham17 opened this issue 1 year ago • 3 comments

Summary of Problem

The compiler fails to resolve a promoted call when the callee is from another imported module. However, when the module is used, it resolves and then works as expected.

Steps to Reproduce

Source Code:

module M1 {
  proc foo(x: real) {
    return x + 1;
  }
}

module M2 {
  import M1; // changing to use allows it to resolve
  proc main() {
    const n = 10;
    var x: [1..n] real;
    x = 1..n;
    var y = M1.foo(x); // promoted call falls to resolve
    writeln(y);
  }
}

Compile command: chpl mytest.chpl

Compile error:

mytest.chpl:9: In function 'main':
mytest.chpl:13: error: unresolved call 'chpl_promo1_foo(x=[domain(1,int(64),false)] real(64), tag=iterKind, followThis=1*range(int(64),bounded,false))'
mytest.chpl:13: note: because no functions named chpl_promo1_foo found in scope

Configuration Information

  • Output of chpl --version: chpl version 1.31.0 pre-release (a58516493e)
  • Output of $CHPL_HOME/util/printchplenv --anonymize: CHPL_TARGET_PLATFORM: darwin CHPL_TARGET_COMPILER: llvm CHPL_TARGET_ARCH: arm64 CHPL_TARGET_CPU: native * CHPL_LOCALE_MODEL: flat CHPL_COMM: none CHPL_TASKS: fifo CHPL_LAUNCHER: none CHPL_TIMERS: generic CHPL_UNWIND: none CHPL_MEM: cstdlib CHPL_ATOMICS: cstdlib CHPL_GMP: bundled CHPL_HWLOC: none CHPL_RE2: bundled CHPL_LLVM: system * CHPL_AUX_FILESYS: none
  • Back-end compiler and version, e.g. gcc --version or clang --version: Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.4.0

jabraham17 avatar Jun 15 '23 15:06 jabraham17