You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to specify a generic return type for a range with a non-default type results in an error. However, fully specifying the return type does work. And just removing the explicit return type also works.
I believe this is a quirk of range being generic with defaults, such that range(?) gives you the defaults. I would have expected that range says "the return type is a range with the type defaults" and range(?) says "the return type is a range with unknown type"
Steps to Reproduce
Source Code:
proc foo():range(?) { // error: initializing a range with strideKind.one from a range with strideKind.positivereturn1..10by2;
}
writeln(foo());
proc foo() { // this is fine and is a workaroundreturn1..10by2;
}
proc foo():range(int, boundKind.both, strideKind.positive) { // this is also fine, being full explicitreturn1..10by2;
}
Compile command: chpl foo.chpl
Configuration Information
Output of chpl --version: 2.2
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: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc +
CHPL_ATOMICS: cstdlib
CHPL_GMP: system +
CHPL_HWLOC: system +
CHPL_RE2: bundled +
CHPL_LLVM: system
CHPL_AUX_FILESYS: none
Back-end compiler and version, e.g. gcc --version or clang --version: LLVM 18
The text was updated successfully, but these errors were encountered:
Summary of Problem
Description:
Attempting to specify a generic return type for a range with a non-default type results in an error. However, fully specifying the return type does work. And just removing the explicit return type also works.
I believe this is a quirk of range being generic with defaults, such that
range(?)
gives you the defaults. I would have expected thatrange
says "the return type is a range with the type defaults" andrange(?)
says "the return type is a range with unknown type"Steps to Reproduce
Source Code:
Compile command:
chpl foo.chpl
Configuration Information
chpl --version
: 2.2$CHPL_HOME/util/printchplenv --anonymize
:gcc --version
orclang --version
: LLVM 18The text was updated successfully, but these errors were encountered: