Skip to content

Avoid stackoverflow in associatedFile computation #11010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ object Symbols {

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

private var mySource: SourceFile = NoSource
Expand Down
4 changes: 4 additions & 0 deletions tests/neg/i9327.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// fuzzball, gave SO in associatedFile
package object Foo // error
type Foo // error
class Foo(a: Foo)