@@ -113,7 +113,6 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
113113 import definitions ._
114114 import analyzer ._ // Typer
115115
116- val SYNTH_CASE = Flags .CASE | SYNTHETIC
117116
118117 case class DefaultOverrideMatchAttachment (default : Tree )
119118
@@ -241,7 +240,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
241240 // append the default to the list of cases and suppress the unreachable case error that may arise (once we detect that...)
242241 val matchFailGenOverride = match_.attachments.get[DefaultOverrideMatchAttachment ].map{case DefaultOverrideMatchAttachment (default) => ((scrut : Tree ) => default)}
243242
244- val selectorSym = freshSym(selector.pos, pureType(selectorTp)) setFlag SYNTH_CASE
243+ val selectorSym = freshSym(selector.pos, pureType(selectorTp)) setFlag treeInfo.SYNTH_CASE_FLAGS
244+
245245 // pt = Any* occurs when compiling test/files/pos/annotDepMethType.scala with -Xexperimental
246246 val combined = combineCases(selector, selectorSym, cases map translateCase(selectorSym, pt), pt, matchOwner, matchFailGenOverride)
247247
@@ -1316,6 +1316,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
13161316 def freshSym (pos : Position , tp : Type = NoType , prefix : String = " x" ) =
13171317 NoSymbol .newTermSymbol(freshName(prefix), pos) setInfo tp
13181318
1319+ def newSynthCaseLabel (name : String ) =
1320+ NoSymbol .newLabel(freshName(name), NoPosition ) setFlag treeInfo.SYNTH_CASE_FLAGS
1321+
13191322 // codegen relevant to the structure of the translation (how extractors are combined)
13201323 trait AbsCodegen {
13211324 def matcher (scrut : Tree , scrutSym : Symbol , restpe : Type )(cases : List [Casegen => Tree ], matchFailGen : Option [Tree => Tree ]): Tree
@@ -1486,7 +1489,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
14861489 case object FalseCond extends Cond {override def toString = " F" }
14871490
14881491 case class AndCond (a : Cond , b : Cond ) extends Cond {override def toString = a + " /\\ " + b}
1489- case class OrCond (a : Cond , b : Cond ) extends Cond {override def toString = " (" + a+ " ) \\ / (" + b + " )" }
1492+ case class OrCond (a : Cond , b : Cond ) extends Cond {override def toString = " (" + a+ " ) \\ / (" + b + " )" }
14901493
14911494 object EqualityCond {
14921495 private val uniques = new collection.mutable.HashMap [(Tree , Tree ), EqualityCond ]
@@ -3108,7 +3111,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
31083111 }
31093112 }
31103113
3111- private val defaultLabel : Symbol = NoSymbol .newLabel(freshName( " default" ), NoPosition ) setFlag SYNTH_CASE
3114+ private val defaultLabel : Symbol = newSynthCaseLabel( " default" )
31123115
31133116 /** Collapse guarded cases that switch on the same constant (the last case may be unguarded).
31143117 *
@@ -3476,11 +3479,11 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
34763479 * if keepGoing is false, the result Some(x) of the naive translation is encoded as matchRes == x
34773480 */
34783481 def matcher (scrut : Tree , scrutSym : Symbol , restpe : Type )(cases : List [Casegen => Tree ], matchFailGen : Option [Tree => Tree ]): Tree = {
3479- val matchEnd = NoSymbol .newLabel(freshName( " matchEnd" ), NoPosition ) setFlag SYNTH_CASE
3482+ val matchEnd = newSynthCaseLabel( " matchEnd" )
34803483 val matchRes = NoSymbol .newValueParameter(newTermName(" x" ), NoPosition , SYNTHETIC ) setInfo restpe.withoutAnnotations //
34813484 matchEnd setInfo MethodType (List (matchRes), restpe)
34823485
3483- def newCaseSym = NoSymbol .newLabel(freshName( " case" ), NoPosition ) setInfo MethodType (Nil , restpe) setFlag SYNTH_CASE
3486+ def newCaseSym = newSynthCaseLabel( " case" ) setInfo MethodType (Nil , restpe)
34843487 var _currCase = newCaseSym
34853488
34863489 val caseDefs = cases map { (mkCase : Casegen => Tree ) =>
0 commit comments