Skip to content

Export+import cause Cyclic reference involving val <import> error #13120

Closed
@soronpo

Description

@soronpo

This error was very difficult to minimize.
Features that are participating: opaque types, export, and import.
In the example, if the opaque directly refers to container.ir.Foo there is no error.
If we remove the export, there is no error.

Compiler version

3.0.3-RC1-bin-20210716-cc47c56-NIGHTLY

Minimized code

Minimized project at: https://github.com/soronpo/dottybug/tree/export_cyclic_err

container.scala

object container:
  object ir:
    sealed trait Foo

Foo.scala

import container.ir

opaque type Foo = ir.Foo

object Foo:
  def bar(foo: Foo): Unit = {}

export Foo.*

Output

[error] -- [E046] Cyclic Error: C:\IdeaProjects\dottybug\src\main\scala\Foo.scala:3:18 ----------------------------
[error] 3 |opaque type Foo = ir.Foo
[error]   |                  ^
[error]   |                  Cyclic reference involving val <import>
[error] one error found

Expectation

No error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions