File tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ object Erasure {
388
388
case Block (_, tpt) => tpt // erase type aliases (statements) from type block
389
389
case tpt => tpt
390
390
}
391
- val tpt2 = promote (tpt1)
391
+ val tpt2 = typedType (tpt1)
392
392
val expr1 = typed(expr, tpt2.tpe)
393
393
assignType(untpd.cpy.Typed (tree)(expr1, tpt2), tpt2)
394
394
}
@@ -736,6 +736,9 @@ object Erasure {
736
736
override def typedTypeDef (tdef : untpd.TypeDef , sym : Symbol )(implicit ctx : Context ): Tree =
737
737
EmptyTree
738
738
739
+ override def typedAnnotated (tree : untpd.Annotated , pt : Type )(implicit ctx : Context ): Tree =
740
+ typed(tree.arg, pt)
741
+
739
742
override def typedStats (stats : List [untpd.Tree ], exprOwner : Symbol )(implicit ctx : Context ): List [Tree ] = {
740
743
val stats1 =
741
744
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