Closed
Description
The back-edge check to prevent infinitely nested tag types rejects some valid programs, namely those that look like this:
tag a { ... }
tag b { FOO(a); }
The order of the tag declarations must be switched.
Instead of comparing opaque IDs, we could instead do the following: In the Semant context, store a well-ordering on every tag type. Every time a type /a/ is contained in a type /b/ without boxing, we declare that /a/ < /b/. Then boxed back-pointers from /b/ to /a/ result in opaque types. Any contradiction (declaring that /b/ < /a/ when /a/ < /b/ is already established) results in an error, because a type would have infinite size.