19975, "rmzs0711", "The compiler can't figure out what it needs to call, when Module's and Procedure's names are equal", "2022-06-12T09:20:22Z"
Summary of Problem
Steps to Reproduce
hello2-module.chpl:
module A {
proc A() {}
}
module Main {
proc main() {
use A;
A.A();
}
}
If we use not equal names for module and procedure, it works fine. But if they are equal like above I have this output
hello2-module.chpl:12: In function 'main':
hello2-module.chpl:15: error: unresolved call 'shared chpl__fcf_type_void_void.A()'
hello2-module.chpl:4: note: this candidate did not match: A()
hello2-module.chpl:15: note: because call is written as a method call
hello2-module.chpl:4: note: but candidate function is not a method
If we use some other module, that will cause an ambiguous call problem, and we will resolve it explicitly, B.A() works fine, but A.A() not
hello2-module.chpl:
module A {
proc A() {}
}
module B {
proc A() {}
}
module Main {
proc main() {
use A;
use B;
B.A() // OK
A.A(); // error: 'A' undeclared (first use this function)
}
}
hello2-module.chpl:12: In function 'main':
hello2-module.chpl:16: error: 'A' undeclared (first use this function)
Compile command:
chpl hello2-module.chpl
Execution command:
./hello2-module
Configuration Information
-
Output of
chpl --version
:
chpl version 1.27.0 pre-release (227763f22c)
built with LLVM version 12.0.0
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details) -
Output of
$CHPL_HOME/util/printchplenv --anonymize
:
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: gnu
CHPL_TARGET_ARCH: x86_64
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: none *
CHPL_HWLOC: none
CHPL_RE2: none *
CHPL_LLVM: none *
CHPL_AUX_FILESYS: none
- Back-end compiler and version, e.g.
gcc --version
orclang --version
:
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin