-
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.
Merge pull request #4731 from dotty-staging/package-object
Fix printing of package object symbol
- Loading branch information
Showing
2 changed files
with
33 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
27 changes: 27 additions & 0 deletions
27
compiler/test/dotty/tools/dotc/printing/PrinterTests.scala
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,27 @@ | ||
package dotty.tools.dotc.printing | ||
|
||
import dotty.tools.DottyTest | ||
import dotty.tools.dotc.ast.tpd | ||
import dotty.tools.dotc.core.Names._ | ||
import dotty.tools.dotc.core.Symbols._ | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class PrinterTests extends DottyTest { | ||
import tpd._ | ||
|
||
@Test | ||
def packageObject: Unit = { | ||
val source = """ | ||
package object foo { | ||
def bar: Int = 1 | ||
} | ||
""" | ||
|
||
checkCompile("frontend", source) { (tree, context) => | ||
implicit val ctx = context | ||
val bar = tree.find(tree => tree.symbol.name == termName("bar")).get | ||
assertEquals("package object foo", bar.symbol.owner.show) | ||
} | ||
} | ||
} |