@@ -618,24 +618,25 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
618
618
accu(Set .empty, selType)
619
619
}
620
620
621
- def typedCase (tree : untpd.CaseDef ): CaseDef = track(" typedCase" ) {
622
- def caseRest (pat : Tree )(implicit ctx : Context ) = {
623
- gadtSyms foreach (_.resetGADTFlexType)
624
- pat foreachSubTree {
625
- case b : Bind =>
626
- if (ctx.scope.lookup(b.name) == NoSymbol ) ctx.enter(b.symbol)
627
- else ctx.error(d " duplicate pattern variable: ${b.name}" , b.pos)
628
- case _ =>
629
- }
630
- val guard1 = typedExpr(tree.guard, defn.BooleanType )
631
- val body1 = typedExpr(tree.body, pt)
632
- assignType(cpy.CaseDef (tree)(pat, guard1, body1), body1)
621
+ cases mapconserve (typedCase(_, pt, selType, gadtSyms))
622
+ }
623
+
624
+ def typedCase (tree : untpd.CaseDef , pt : Type , selType : Type , gadtSyms : Set [Symbol ])(implicit ctx : Context ): CaseDef = track(" typedCase" ) {
625
+ def caseRest (pat : Tree )(implicit ctx : Context ) = {
626
+ gadtSyms foreach (_.resetGADTFlexType)
627
+ pat foreachSubTree {
628
+ case b : Bind =>
629
+ if (ctx.scope.lookup(b.name) == NoSymbol ) ctx.enter(b.symbol)
630
+ else ctx.error(d " duplicate pattern variable: ${b.name}" , b.pos)
631
+ case _ =>
633
632
}
634
- val doCase : () => CaseDef =
635
- () => caseRest(typedPattern( tree.pat, selType))(ctx.fresh.setNewScope )
636
- (doCase /: gadtSyms)((op, tsym) => tsym.withGADTFlexType(op))( )
633
+ val guard1 = typedExpr(tree.guard, defn. BooleanType )
634
+ val body1 = typedExpr( tree.body, pt )
635
+ assignType(cpy. CaseDef (tree)(pat, guard1, body1), body1 )
637
636
}
638
- cases mapconserve typedCase
637
+ val doCase : () => CaseDef =
638
+ () => caseRest(typedPattern(tree.pat, selType))(ctx.fresh.setNewScope)
639
+ (doCase /: gadtSyms)((op, tsym) => tsym.withGADTFlexType(op))()
639
640
}
640
641
641
642
def typedReturn (tree : untpd.Return )(implicit ctx : Context ): Return = track(" typedReturn" ) {
0 commit comments