Skip to content

Commit b0f7e26

Browse files
Merge pull request #11010 from dotty-staging/fix-#9327
Avoid stackoverflow in associatedFile computation
2 parents 2cdfcbb + ca1dbcc commit b0f7e26

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ object Symbols {
429429

430430
/** The source or class file from which this class was generated, null if not applicable. */
431431
override def associatedFile(using Context): AbstractFile =
432-
if (assocFile != null || this.owner.is(PackageClass) || this.isEffectiveRoot) assocFile
432+
if assocFile != null || this.is(Package) || this.owner.is(Package) then assocFile
433433
else super.associatedFile
434434

435435
private var mySource: SourceFile = NoSource

tests/neg/i9327.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// fuzzball, gave SO in associatedFile
2+
package object Foo // error
3+
type Foo // error
4+
class Foo(a: Foo)

0 commit comments

Comments
 (0)