New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function literal used as a statement #1565
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1565?orig=1 |
Geoffrey Alan Washburn (washburn) said: scala> def x() = { 0; (a : Int, b : Int) => println(List(a, b)) ; 0 }
x: ()(Int, Int) => Int Shouldn't x be a function from ()=>Int ? No, for two reasons. (1) x is a method. Method types are printed as |
@lexspoon said: |
Geoffrey Alan Washburn (washburn) said: Yes, arbitrary expressions should ideally be usable as statements. But as I pointed out in #1564, the problem is not at all related to how the interpreter is implemented. The problem is entirely within the parser. |
Shouldn't this situation be allowed? A function literal is an expression, and an expression is usable as a statement. I tried to make Issue 1564, but I ran into this issue.
On a related note, the following output is weird:
Shouldn't x be a function from ()=>Int ?
The text was updated successfully, but these errors were encountered: