Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class TryCatchPatterns extends MiniPhase {
(pre == NoPrefix || pre.widen.typeSymbol.isStatic) && // Does not require outer class check
!tp.symbol.is(Flags.Trait) && // Traits not supported by JVM
tp.derivesFrom(defn.ThrowableClass)
case tp: AppliedType =>
isSimpleThrowable(tp.tycon)
case _ =>
false
}
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i756.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Test[T] {

def f(x: Int) = try {
???
}
catch {
case ex: scala.runtime.NonLocalReturnControl[T @scala.unchecked] =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a BytecodeTest that checks that we don't use the instanceof opcode: https://github.com/lampepfl/dotty/blob/master/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala

???
}
}