We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
()
finally
1 parent 3dfba6d commit 4aa44f5Copy full SHA for 4aa44f5
compiler/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -2004,7 +2004,12 @@ object Parsers {
2004
}
2005
2006
val finalizer =
2007
- if (in.token == FINALLY) { in.nextToken(); subExpr() }
+ if (in.token == FINALLY) {
2008
+ in.nextToken();
2009
+ val expr = subExpr()
2010
+ if expr.span.exists then expr
2011
+ else Literal(Constant(())) // finally without an expression
2012
+ }
2013
else {
2014
if (handler.isEmpty) warning(
2015
EmptyCatchAndFinallyBlock(body),
tests/neg-custom-args/fatal-warnings/i9168.scala
@@ -0,0 +1 @@
1
+def g: Int = try 42 finally ; // error
0 commit comments