forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make error reporting resilient to exception thrown while reporting (s…
…cala#20158) Previously the added test failed with `1 error reported` but no actual error message printed, because a stack overflow is thrown while reporting the original error. This is then caught and handled to emit a RecursionOverflow error, but that second error is non-sensical and non-sensical errors are only printed if `hasErrors` returns false. We fix this by deferring incrementing the error count (and therefore having `hasErrors` return true) until after having displayed the error. We also defer calling `markReported` otherwise the second error will also be suppressed. A similar change is necessary in our testing infrastructure to keep the error count is coherent.
- Loading branch information
Showing
3 changed files
with
24 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
trait Expr: | ||
type Value | ||
object Expr: | ||
type Of[V] = Expr { type Value = V } | ||
type ExtractValue[F <: Expr] = F match | ||
case Expr.Of[v] => v | ||
import Expr.ExtractValue | ||
|
||
class SimpleLoop1 extends Expr: | ||
type Value = ExtractValue[SimpleLoop2] | ||
|
||
class SimpleLoop2 extends Expr: | ||
type Value = ExtractValue[SimpleLoop1] | ||
|
||
object Test1: | ||
val x: ExtractValue[SimpleLoop1] = 1 // error |