Skip to content

Broken error message when trying to eta-expand a by-name #4157

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

Closed
smarter opened this issue Mar 22, 2018 · 0 comments
Closed

Broken error message when trying to eta-expand a by-name #4157

smarter opened this issue Mar 22, 2018 · 0 comments
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug prio:low

Comments

@smarter
Copy link
Member

smarter commented Mar 22, 2018

object Test {
  def foo(x: => Int) ={
    val a = x _ // error
    val b: () => Int = x _ // error
  }
}

The first error message is correct, but the second leaks the ErrorType and thus looks confusing:

-- [E099] Syntax Error: try/byeta.scala:3:14 -----------------------------------
3 |    val a = x _ // error
  |            ^^^
  |            Not a function: => Int(x): cannot be followed by _

longer explanation available when compiling with `-explain`
-- [E099] Syntax Error: try/byeta.scala:4:25 -----------------------------------
4 |    val b: () => Int = x _ // error
  |                       ^^^
  |                       Not a function: <error found:    Int
  |                       required: () => Int
  |                       
  |                       >: cannot be followed by _
@smarter smarter added itype:bug prio:low area:reporting Error reporting including formatting, implicit suggestions, etc labels Mar 22, 2018
@smarter smarter self-assigned this Mar 22, 2018
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 22, 2018
Avoid leaking error types in the printed error messages
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 22, 2018
Avoid leaking error types in the printed error messages
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 22, 2018
Avoid leaking error types in the printed error messages
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2018
Avoid leaking error types in the printed error messages
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2018
Avoid leaking error types in the printed error messages
smarter added a commit that referenced this issue Mar 23, 2018
Fix #4157: Broken error message when trying to eta-expand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug prio:low
Projects
None yet
Development

No branches or pull requests

1 participant