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 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

This comment has been minimized.

Copy link
Author

@scabug 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

This comment has been minimized.

Copy link
Author

@scabug 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.

@scabug scabug closed this Oct 31, 2011
@scabug scabug added the infer label Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.