Skip to content

Commit ae8f80e

Browse files
committed
Remove Nothing restriction on unused parameters
1 parent f1aa9fc commit ae8f80e

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,8 @@ object Checking {
384384
sym.setFlag(Private) // break the overriding relationship by making sym Private
385385
}
386386
checkApplicable(UnusedType, !sym.is(UnusedType))
387-
if (sym.is(Unused)) {
387+
if (sym.is(Unused))
388388
checkApplicable(Unused, !sym.is(MutableOrLazy))
389-
if (sym.info.widen.finalResultType.isBottomType)
390-
fail("unused " + sym.showKind + " cannot have type Nothing")
391-
}
392389
}
393390

394391
/** Check the type signature of the symbol `M` defined by `tree` does not refer

tests/neg/unused-Nothing.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/run/unused-2.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ object Test {
22

33
def main(args: Array[String]): Unit = {
44

5-
unused def !!! : Null = ???
5+
unused def !!! : Nothing = ???
66

77
try {
88
fun(!!!)
@@ -12,7 +12,7 @@ object Test {
1212
}
1313
}
1414

15-
def fun(unused bottom: Null): Unit = {
15+
def fun(unused bottom: Nothing): Unit = {
1616
println("fun")
1717
}
1818
}

0 commit comments

Comments
 (0)