def foo: Any = {return 1; 2}
^
one warning found
~/code: echo $?
0
~/code: scala -Xfatal-warnings -Ywarn-dead-code -e 'def foo: Any =
{return 1; 2}'
/var/folders/vQ/vQZfxx8pGp8OZLoN+ZWxTk+++TI/-Tmp-/scalacmd2634965528144388727.scala:1:
error: dead code following this construct
def foo: Any = {return 1; 2}
^
one error found
~/code: echo $?1
On Thu, Jul 8, 2010 at 11:45 PM, Hans Brattberg wrote:
> Hi!
>
> Maybe this is a newbie question, but is there such a thing as compiler
> error for unreachable code in Scala?
>
> For instance this function compiles:
>
> def a() : Unit = {
> return
> 1+1
> }
>
> Why?
>
> /Hans
>
> --
> Hans Brattberg
> hans.brattberg@crisp.se
> www.crisp.se/hans.brattberg
> +46 (0)70 575 31 32
>
def foo: Any = {return 1; 2}
^
one warning found
~/code: echo $?
0
~/code: scala -Xfatal-warnings -Ywarn-dead-code -e 'def foo: Any =
{return 1; 2}'
/var/folders/vQ/vQZfxx8pGp8OZLoN+ZWxTk+++TI/-Tmp-/scalacmd2634965528144388727.scala:1:
error: dead code following this construct
def foo: Any = {return 1; 2}
^
one error found
~/code: echo $?1
On Thu, Jul 8, 2010 at 11:45 PM, Hans Brattberg wrote:
> Hi!
>
> Maybe this is a newbie question, but is there such a thing as compiler
> error for unreachable code in Scala?
>
> For instance this function compiles:
>
> def a() : Unit = {
> return
> 1+1
> }
>
> Why?
>
> /Hans
>
> --
> Hans Brattberg
> hans.brattberg@crisp.se
> www.crisp.se/hans.brattberg
> +46 (0)70 575 31 32
>