Skip to content

Back-edge check (Semant.is_back_edge) is too strong #162

@pcwalton

Description

@pcwalton

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions