chapel icon indicating copy to clipboard operation
chapel copied to clipboard

[Bug]: Forwarding to a badly formatted `var` declaration causes an internal error

Open bradcray opened this issue 9 months ago • 0 comments

Summary of Problem

Description:

When applying forwarding to a variable declaration, I got an internal error. At first, I was worried it was a case of the feature being brittle in an advanced use case, but it turns out I just had something more akin to a syntax error in my code that caused the issue.

In developer mode, this shows up as:

[/path/to/frontend/lib/parsing/ParserContextImpl.h:2468 in buildForwardingDecl] Assertion failed: cs.stmt->isVariable() || cs.stmt->isMultiDecl() || cs.stmt->isTupleDecl()
error: invoking driver compilation phase

In user mode, it's:

Internal errors indicate a bug in the Chapel compiler,
and we're sorry for the hassle.  We would appreciate your reporting this bug --
please see https://chapel-lang.org/bugs.html for instructions.

Is this a blocking issue with no known work-arounds?

no, the workaround is to fix the user error. E.g., in the example below, I should've used something more like var m: map(int, real);

Steps to Reproduce

Source Code:

use Map;

class C {
  forwarding var map(int, real);
}

var myC = new C();
myC.add(1, 2.3);

Associated Future Test(s): test/classes/forwarding/forwardToNonVar.chpl #25068

Configuration Information

  • Output of chpl --version: chpl version 2.1.0 pre-release (af0a260238)

bradcray avatar May 16 '24 23:05 bradcray