|
[#1201] |
project: compiler |
priority: low |
category: missing feature |
|
submitter |
assigned to |
status |
date submitted |
|
Burak |
Martin |
won't fix |
2007-07-09 11:46:25.0 |
subject |
single-branch if eats up result |
code |
scala> val x: AnyVal = ()
x: AnyVal = ()
scala> val x: AnyVal = if (true) 1 else ()
x: AnyVal = 1
scala> val x: AnyVal = if (true) 1
x: AnyVal = () |
what happened |
the above executes in interpreter and is according to spec
|
what expected |
it's not intuitive. spec should take the possibility of AnyVal into account, and let the if return its result. it's more efficient to represent option[valtype] this way. alternatively, we have to discourage using anyval as an actual type |
[back to overview] |