Skip to content

Commit 039d826

Browse files
committed
Suppress non-local return unchecked warnings.
There doesn't seem to be any way to do that by adding a synthetic annotation.
1 parent 87e23f5 commit 039d826

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Infer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,8 @@ trait Infer {
12761276
} else {
12771277
for (arg <- args) {
12781278
if (sym == ArrayClass) check(arg, bound)
1279-
else if (arg.typeArgs.nonEmpty) () // avoid spurious warnings with higher-kinded types
1279+
else if (arg.typeArgs.nonEmpty) () // avoid spurious warnings with higher-kinded types
1280+
else if (sym == NonLocalReturnControlClass) () // no way to suppress unchecked warnings on try/catch
12801281
else arg match {
12811282
case TypeRef(_, sym, _) if isLocalBinding(sym) =>
12821283
;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-unchecked -Xfatal-warnings
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class A {
2+
def f: Boolean = {
3+
val xs = Nil map (_ => return false)
4+
true
5+
}
6+
}

0 commit comments

Comments
 (0)