-
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.
If one indulges in cycles to heavily it can happen that we run into an infinite recursion in `fullyDefinedType` even before we had a chance to run `checkNonCyclic`. In this case we now diagnose the stack overflow as an error message instead of fialing with an internal error. Fixes #15311
- Loading branch information
Showing
9 changed files
with
123 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-- Error: tests/neg/i15311.scala:16:4 ---------------------------------------------------------------------------------- | ||
16 |def test = // error | ||
|^ | ||
|Recursion limit exceeded. | ||
|Maybe there is an illegal cyclic reference? | ||
|If that's not the case, you could also try to increase the stacksize using the -Xss JVM option. | ||
|A recurring operation is (inner to outer): | ||
| | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| ... | ||
| | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined food.T | ||
| check fully defined Template[food.T] | ||
17 | eat(ham) | ||
18 | eat(food.self) |
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,18 @@ | ||
trait Template[+T <: Template[T]]: | ||
type Clone <: T { type Clone = Template.this.Clone } | ||
val self :Clone | ||
|
||
type Food = Template[_] | ||
|
||
class Ham extends Template[Ham]: | ||
type Clone = Ham | ||
val self = this | ||
|
||
def eat[F <: Template[F]](food :F) :F = food.self.self | ||
|
||
val ham = new Ham | ||
val food :Food = ham | ||
|
||
def test = // error | ||
eat(ham) | ||
eat(food.self) |