bug
bug copied to clipboard
False "dead code" warning with throwing parameter default value
With -Ywarn-dead-code :
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def foo[T](v: => T = throw new Exception()): T = v
<console>:7: warning: dead code following this construct
def foo[T](v: => T = throw new Exception()): T = v
^
Imported From: https://issues.scala-lang.org/browse/SI-9292?orig=1 Reporter: Espen Wiborg (espenhw) Affected Versions: 2.11.6
Remains reproducible in Scala 2.13.16.
I don't think Scala 3 has this lint.