Chapel: Unable to resolve type when using type alias

Created on 26 Mar 2019  路  3Comments  路  Source: chapel-lang/chapel

Summary of Problem

Bug. The following code doesn't compile if the type alias ta is used, but does compile if you hard-code ta into the class. C stores G(D) objects so it isn't quite recursive with D.

Steps to Reproduce

Source Code:

 // I was using LinkedList, but any generic will do.
class G { type t; }

type ta = G(D);

class C {
  var x: ta; // error: unable to resolve type
  /* var x: G(D); // Ok. */
}

class D {
  var y: C;
}

proc main() {
  var c = new owned C();
}

chpl version 1.19.0

Compiler Bug

Most helpful comment

I think it has something to do with the somewhat cyclic nature of the classes. If I change D.y to be of type int, it compiles.

All 3 comments

Huh... Do any of our initializer or resolution gurus know why this would be different than a top-level variable (which works)? @benharsh, @lydia-duncan, @mppf?

I coulda sworn I'd written a test specifically to lock in that it worked, but I'm not finding it quickly. Seems likely to be related to having to resolve what ta is, and maybe information about the type didn't get propagated correctly during normalize

I think it has something to do with the somewhat cyclic nature of the classes. If I change D.y to be of type int, it compiles.

Was this page helpful?
0 / 5 - 0 ratings