chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.78k stars 418 forks source link

[Bug]: Attempting to forward a module variable causes internal error #25692

Open jabraham17 opened 1 month ago

jabraham17 commented 1 month ago

Summary of Problem

Description:

Attempting to incorrectly use forwarding on a module-scoped variable or expression results in an internal error. This should just be an error message that forwarding does not work at module scope.

Is this issue currently blocking your progress? no

Steps to Reproduce

Source Code:

module M {
  var x: int;
  forwarding x; // internal error
  // forwarding var y: int; // results in the same error
}

Configuration Information

mppf commented 2 weeks ago

In working on PR #25878 I noticed this case also fails with an internal error (which I am supposing is similar). The difference is that this one could plausibly work.

record R1 {
  proc foo() { return 1; }
}
record R2 {
  proc foo() { return 2; }
}

record Wrapper {
  var r1: R1;
  forwarding something;
}

proc Wrapper.something { return r1; }
proc something { return new R2(); } // production: compiler crash unless this is commented out

var x:Wrapper;
writeln(x.foo());

That PR adds this as a future forwarding-to-method-and-non-method.chpl that refers to this issue.