New Issue: Method with bad return type expression causes compiler assertion failure

20501, "daviditen", "Method with bad return type expression causes compiler assertion failure", "2022-08-24T19:00:38Z"

Summary of Problem

The following class and method declaration causes an assertion failure. Removing the explicit return type for the method or adding a colon (foo(): CC) makes it compile.

Steps to Reproduce

Source Code:

class CC {
  proc foo() CC {
    return new unmanaged CC();
  }
}

Compile command:

% chpl cc.chpl
Assertion failed: (scopeStack.back().tag == tag), function exitScope, file ./ParserContextImpl.h, line 345.
Abort trap: 6

Configuration Information

  • Output of chpl --version:
    chpl version 1.28.0 pre-release (dc228b96ba)
    built with LLVM version 12.0.1

  • Output of $CHPL_HOME/util/printchplenv --anonymize:
    CHPL_TARGET_PLATFORM: darwin
    CHPL_TARGET_COMPILER: llvm
    CHPL_TARGET_ARCH: x86_64
    CHPL_TARGET_CPU: none *
    CHPL_LOCALE_MODEL: flat
    CHPL_COMM: none
    CHPL_TASKS: qthreads
    CHPL_LAUNCHER: none
    CHPL_TIMERS: generic
    CHPL_UNWIND: system *
    CHPL_MEM: jemalloc
    CHPL_ATOMICS: cstdlib
    CHPL_GMP: none
    CHPL_HWLOC: bundled
    CHPL_RE2: bundled
    CHPL_LLVM: system
    CHPL_AUX_FILESYS: none