Skip to content

Over-eager Cyclic References when compiling Opaque Types #16642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
odersky opened this issue Jan 9, 2023 · 0 comments · Fixed by #16644
Closed

Over-eager Cyclic References when compiling Opaque Types #16642

odersky opened this issue Jan 9, 2023 · 0 comments · Fixed by #16644

Comments

@odersky
Copy link
Contributor

odersky commented Jan 9, 2023

Compiler version

All 3.x versions

Minimized example

object Syms:
  import SymDs.*
  opaque type Symbol <: AnyRef  // compiles OK if <: AnyRef is missing
    = SymDenotation

object SymDs:
  import Syms.*
  class SymDenotation(sym: Symbol)

Output

3 |  opaque type Symbol <: AnyRef
  |              ^
  |              Cyclic reference involving type Symbol
  |
  | longer explanation available when compiling with `-explain`

Expectation

Should compile in the same way as when <: AnyRef is missing.

@odersky odersky added the stat:needs triage Every issue needs to have an "area" and "itype" label label Jan 9, 2023
@odersky odersky self-assigned this Jan 9, 2023
@odersky odersky added area:typer area:opaque-types itype:bug and removed area:typer stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 9, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 9, 2023
When we have a TypeBounds tree that also has an alias, we checked
that the alias is within bounds at Typer. This could provoke a
CyclicReference when processing opaque type aliases where
the type has a bound and also the alias refers back to the type.
We avoid the problem by performing the check at PostTyper, analogous
to other bounds checks.

Fixes scala#16642
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 9, 2023
When we have a TypeBounds tree that also has an alias, we checked
that the alias is within bounds at Typer. This could provoke a
CyclicReference when processing opaque type aliases where
the type has a bound and also the alias refers back to the type.
We avoid the problem by performing the check at PostTyper, analogous
to other bounds checks.

Fixes scala#16642
odersky added a commit that referenced this issue Jan 10, 2023
When we have a TypeBounds tree that also has an alias, we checked that
the alias is within bounds at Typer. This could provoke a
CyclicReference when processing opaque type aliases where the type has a
bound and also the alias refers back to the type. We avoid the problem
by performing the check at PostTyper, analogous to other bounds checks.

Fixes #16642
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 11, 2023
When we have a TypeBounds tree that also has an alias, we checked
that the alias is within bounds at Typer. This could provoke a
CyclicReference when processing opaque type aliases where
the type has a bound and also the alias refers back to the type.
We avoid the problem by performing the check at PostTyper, analogous
to other bounds checks.

Fixes scala#16642
little-inferno pushed a commit to little-inferno/dotty that referenced this issue Jan 25, 2023
When we have a TypeBounds tree that also has an alias, we checked
that the alias is within bounds at Typer. This could provoke a
CyclicReference when processing opaque type aliases where
the type has a bound and also the alias refers back to the type.
We avoid the problem by performing the check at PostTyper, analogous
to other bounds checks.

Fixes scala#16642
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants