Skip to content

Commit

Permalink
SI-8875 showCode should print all class constructor modifiers.
Browse files Browse the repository at this point in the history
showCode used to print nothing when the only modifier was a change in
visibility scope (i.e. no flags but privateWithin is set).
  • Loading branch information
gourlaysama committed Oct 10, 2014
1 parent 2b5df37 commit 037f295
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/Printers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ trait Printers extends api.Printers { self: SymbolTable =>
val build.SyntacticClassDef(_, _, _, ctorMods, vparamss, earlyDefs, parents, selfType, body) = cl

// constructor's modifier
if (ctorMods.hasFlag(AccessFlags)) {
if (ctorMods.hasFlag(AccessFlags) || ctorMods.privateWithin != tpnme.EMPTY) {
print(" ")
printModifiers(ctorMods, primaryCtorParam = false)
}
Expand Down
1 change: 1 addition & 0 deletions test/files/run/t8875.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Foo private[foo] (bar: Bar)
11 changes: 11 additions & 0 deletions test/files/run/t8875.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import reflect.runtime.universe._

object Test extends App {

val name = TermName("foo")
val c = q"class Foo private[$name](bar: Bar)"

// this used to print: "class Foo(bar: Bar)"
println(showCode(c))

}

1 comment on commit 037f295

@scala-jenkins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job pr-scala failed for 037f295 Took 77 min. (ping @gourlaysama) (results):


To retry exactly this commit, comment "PLS REBUILD/pr-scala@037f2954f4104d8ddff2e694e248093c83719b6f" on PR 4045.
NOTE: New commits are rebuilt automatically as they appear. A forced rebuild is only necessary for transient failures.

Please sign in to comment.