New Issue: Error message varies when forwarding fails to resolve and has a cycle

18431, "lydia-duncan", "Error message varies when forwarding fails to resolve and has a cycle", "2021-09-15T21:51:46Z"

Summary of Problem

The error message varies when failing to resolve a call in a forwarding cycle. If the outermost forwarding statement is forwarding field!;, then only the "forwarding cycle" error message is printed. However, if the outermost forwarding statement is forwarding field; or forwarding <field declaration>, the cycle message will be printed after a message about failing to resolve the call. It would be good for the error message printed to be the same in all situations (and ideally focus on the forwarding cycle first)

(Note: forwarding with a cycle is not possible when all types involved are records, as this will cause a storage cycle)

Steps to Reproduce

Source Code:

Version A (only "forwarding cycle detected" error message printed)

class A {
  var data: unmanaged B?;
  forwarding data!;
  proc fun(i:int) {}
}
class B {
  var data: unmanaged A?;
  forwarding data!;
}

proc main() {
  var a = new unmanaged A();
  a.fun(1.1);
  delete a;
}

Version B ("forwarding cycle detected" and failure to resolve the call)

class A {
  forwarding var data: unmanaged B?;
  proc fun(i:int) {}
}
class B {
  var data: unmanaged A?;
  forwarding data!;
}

proc main() {
  var a = new unmanaged A();
  a.fun(1.1);
  delete a;
}

Version C ("forwarding cycle detected" and failure to resolve the call)

class A {
  var data: unmanaged B?;
  forwarding data;
  proc fun(i:int) {}
}
class B {
  var data: unmanaged A?;
  forwarding data!;
}

proc main() {
  var a = new unmanaged A();
  a.fun(1.1);
  delete a;
}

Compile command:
chpl foo.chpl

Associated Future Test(s):
TBD

Configuration Information

  • Output of chpl --version: 1.25 (pre-release)