Skip to content

Commit

Permalink
put behind -Xsource:2.14 flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper-M committed Sep 10, 2019
1 parent 491a536 commit 6e7add6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
Expand Up @@ -97,7 +97,8 @@ trait Unapplies extends ast.TreeDSL {
}


private def applyShouldInheritAccess(mods: Modifiers) = mods.hasFlag(PRIVATE) || (!mods.hasFlag(PROTECTED) && mods.hasAccessBoundary)
private def applyShouldInheritAccess(mods: Modifiers) =
currentRun.isScala214 && (mods.hasFlag(PRIVATE) || (!mods.hasFlag(PROTECTED) && mods.hasAccessBoundary))

/** The module corresponding to a case class; overrides toString to show the module's name
*/
Expand Down Expand Up @@ -270,9 +271,14 @@ trait Unapplies extends ast.TreeDSL {
val classTpe = classType(cdef, tparams)
val argss = mmap(paramss)(toIdent)
val body: Tree = New(classTpe, argss)
val inheritedMods = constrMods(cdef)
val copyMods =
if (currentRun.isScala214) {
val inheritedMods = constrMods(cdef)
Modifiers(SYNTHETIC | (inheritedMods.flags & AccessFlags), inheritedMods.privateWithin)
}
else Modifiers(SYNTHETIC)
val copyDefDef = atPos(cdef.pos.focus)(
DefDef(Modifiers(SYNTHETIC | (inheritedMods.flags & AccessFlags), inheritedMods.privateWithin), nme.copy, tparams, paramss, TypeTree(), body)
DefDef(copyMods, nme.copy, tparams, paramss, TypeTree(), body)
)
Some(copyDefDef)
}
Expand Down
1 change: 1 addition & 0 deletions test/files/neg/caseclass_private_constructor.flags
@@ -0,0 +1 @@
-Xsource:2.14
1 change: 1 addition & 0 deletions test/files/pos/caseclass_private_constructor.flags
@@ -0,0 +1 @@
-Xsource:2.14

0 comments on commit 6e7add6

Please sign in to comment.