File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ object Erasure {
388388 case Block (_, tpt) => tpt // erase type aliases (statements) from type block
389389 case tpt => tpt
390390 }
391- val tpt2 = promote (tpt1)
391+ val tpt2 = typedType (tpt1)
392392 val expr1 = typed(expr, tpt2.tpe)
393393 assignType(untpd.cpy.Typed (tree)(expr1, tpt2), tpt2)
394394 }
@@ -736,6 +736,9 @@ object Erasure {
736736 override def typedTypeDef (tdef : untpd.TypeDef , sym : Symbol )(implicit ctx : Context ): Tree =
737737 EmptyTree
738738
739+ override def typedAnnotated (tree : untpd.Annotated , pt : Type )(implicit ctx : Context ): Tree =
740+ typed(tree.arg, pt)
741+
739742 override def typedStats (stats : List [untpd.Tree ], exprOwner : Symbol )(implicit ctx : Context ): List [Tree ] = {
740743 val stats1 =
741744 if (takesBridges(ctx.owner)) new Bridges (ctx.owner.asClass, erasurePhase).add(stats)
Original file line number Diff line number Diff line change 1+ import scala .util .control .NonLocalReturns ._
2+
3+ inline def (op : => T ) rescue[T , E <: Throwable ] (fallback : PartialFunction [E , T ]) =
4+ try op
5+ catch {
6+ case ex : ReturnThrowable [_] => throw ex
7+ case ex : E =>
8+ if (fallback.isDefinedAt(ex)) fallback(ex) else throw ex
9+ }
10+
11+ def test : Unit = {
12+ 9 / 0 rescue { case _ : ArithmeticException => 10 }
13+ }
You can’t perform that action at this time.
0 commit comments