Skip to content

Incremental compilation leads to Cyclic Reference Error #20245

Closed
@b-studios

Description

@b-studios

Incrementally recompiling leads to "Cyclic reference" while fresh compilation succeeds.

We consistently hit this issue when touching our own Typer.scala forcing us to always clean; compile which of course takes longer than incrementally compiling.

Compiler version

3.3.1, 3.4.1

Minimized code

I minimized our compiler to only a few lines of code in:

effekt-lang/effekt#446

the full minimized example (not the diff or PR) can be found here

https://github.com/effekt-lang/effekt/tree/34b9e79126db91604df4785aaabace15d154f8cb

Output

[error] -- [E046] Cyclic Error: /private/tmp/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:15:57
[error] 15 |  private[typer] val unification = new Unification(using this)
[error]    |                                                         ^
[error]    |                                Cyclic reference involving class Context
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] one error found
[error] (root / Compile / compileIncremental) Compilation failed

Expectation

It should consistently compile or always report the error, if this is indeed a problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions