-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error diagnostics for cyclic references (#19408)
We now suggest to compile with -explain-cyclic, in which case we give a trace of the forcings that led to the cycle. The reason for the separate option is that maintaining a trace is not free so we should not be doing it by default.
- Loading branch information
Showing
16 changed files
with
151 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
-- [E044] Cyclic Error: tests/neg-macros/i14772.scala:7:7 -------------------------------------------------------------- | ||
7 | foo(a) // error | ||
-- [E044] Cyclic Error: tests/neg-macros/i14772.scala:8:7 -------------------------------------------------------------- | ||
8 | foo(a) // error | ||
| ^ | ||
| Overloaded or recursive method impl needs return type | ||
| | ||
| The error occurred while trying to compute the signature of method $anonfun | ||
| which required to compute the signature of method impl | ||
| | ||
| Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace. | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//> using options -explain-cyclic | ||
import scala.quoted.* | ||
|
||
object A { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//> using options -explain-cyclic | ||
def test= | ||
val o1 = ownerWorks(1) | ||
println(o1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- [E044] Cyclic Error: tests/neg/cyclic.scala:6:12 -------------------------------------------------------------------- | ||
6 | def i() = f() // error | ||
| ^ | ||
| Overloaded or recursive method f needs return type | ||
| | ||
| The error occurred while trying to compute the signature of method f | ||
| which required to compute the signature of method g | ||
| which required to compute the signature of method h | ||
| which required to compute the signature of method i | ||
| which required to compute the signature of method f | ||
| | ||
| Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace. | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//> using options -explain-cyclic | ||
object O: | ||
def f() = g() | ||
def g() = h() | ||
def h() = i() | ||
def i() = f() // error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.