Skip to content
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

Weird lazy val type inference in anonymous function #5099

Closed
scabug opened this issue Oct 20, 2011 · 2 comments
Closed

Weird lazy val type inference in anonymous function #5099

scabug opened this issue Oct 20, 2011 · 2 comments
Assignees
Labels

Comments

@scabug
Copy link

scabug commented Oct 20, 2011

In the following, return type is inferred as (=> a).
Is this the right behavior?

class LazyValVsFunctionType[a]  {
    val f: a => a = x => {
        lazy val _x: a = throw new java.lang.Error("todo")
        _x // error: type mismatch
/*
[error]  found   : a => => a
[error]  required: a => a
[error]     val f: a => a = x => {
[error]                       ^
[error] one error found
*/
        // _x: a // ok
    }
}
@scabug
Copy link
Author

scabug commented Oct 20, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5099?orig=1
Reporter: @okomok
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Oct 31, 2011

Commit Message Bot (anonymous) said:
(extempore in r25916) Clean result of function type.

NullaryMethodType was escaping. Closes #5099, review by moors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants