Skip to content

Commit 2a8291a

Browse files
committed
Merge pull request scala#1666 from paulp/issue/6707
Flag pattern matcher synthetics as synthetic.
2 parents d2feaeb + 3177934 commit 2a8291a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/compiler/scala/tools/nsc/transform/UnCurry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ abstract class UnCurry extends InfoTransform
369369
}
370370

371371
val isDefinedAtMethodDef = {
372-
val methSym = anonClass.newMethod(nme.isDefinedAt, fun.pos, FINAL)
372+
val methSym = anonClass.newMethod(nme.isDefinedAt, fun.pos, FINAL | SYNTHETIC)
373373
val params = methSym newSyntheticValueParams formals
374374
methSym setInfoAndEnter MethodType(params, BooleanClass.tpe)
375375

src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
11531153

11541154
// ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` by `Select(q, outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix`
11551155
// if there's an outer accessor, otherwise the condition becomes `true` -- TODO: can we improve needsOuterTest so there's always an outerAccessor?
1156-
val outer = expectedTp.typeSymbol.newMethod(vpmName.outer) setInfo expectedTp.prefix setFlag SYNTHETIC | ARTIFACT
1156+
val outer = expectedTp.typeSymbol.newMethod(vpmName.outer, newFlags = SYNTHETIC | ARTIFACT) setInfo expectedTp.prefix
11571157

11581158
(Select(codegen._asInstanceOf(testedBinder, expectedTp), outer)) OBJ_EQ expectedOuter
11591159
}
@@ -1415,7 +1415,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
14151415

14161416
// assert(owner ne null); assert(owner ne NoSymbol)
14171417
def freshSym(pos: Position, tp: Type = NoType, prefix: String = "x") =
1418-
NoSymbol.newTermSymbol(freshName(prefix), pos) setInfo tp
1418+
NoSymbol.newTermSymbol(freshName(prefix), pos, newFlags = SYNTHETIC) setInfo tp
14191419

14201420
def newSynthCaseLabel(name: String) =
14211421
NoSymbol.newLabel(freshName(name), NoPosition) setFlag treeInfo.SYNTH_CASE_FLAGS
@@ -3611,7 +3611,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
36113611
*/
36123612
def matcher(scrut: Tree, scrutSym: Symbol, restpe: Type)(cases: List[Casegen => Tree], matchFailGen: Option[Tree => Tree]): Tree = {
36133613
val matchEnd = newSynthCaseLabel("matchEnd")
3614-
val matchRes = NoSymbol.newValueParameter(newTermName("x"), NoPosition, SYNTHETIC) setInfo restpe.withoutAnnotations
3614+
val matchRes = NoSymbol.newValueParameter(newTermName("x"), NoPosition, newFlags = SYNTHETIC) setInfo restpe.withoutAnnotations
36153615
matchEnd setInfo MethodType(List(matchRes), restpe)
36163616

36173617
def newCaseSym = newSynthCaseLabel("case") setInfo MethodType(Nil, restpe)

0 commit comments

Comments
 (0)