Skip to content

Unary identifier has undue expectation of subsequent expressionΒ #7910

Closed

Description

@som-snytt

minimized code

  def k = {
    object + extends Function1[Int, Int] { def apply(i: Int): Int = i + 1 }
    val g: Int => Int = +
    g(1)
  }

13 |    val g: Int => Int = +
   |                         ^
   |                         expression expected but end of statement found

@hrhino said his tests for scala/scala#8617 worked, so I tried mine, too.

  final val x = 42
  def f = {
    import x._
    val g: Int => Int = +
    g(1)
  }

expectation

Unary ids are ordinary identifiers.

Activity

  1. self-assigned this
    on Jan 7, 2020
  2. odersky commented on Mar 15, 2021

    @odersky
    Contributor

    I don't think I will fix this, after all. If someone wants to take this over, please reopen.

  3. added a commit that references this issue on May 12, 2026
    21dd6a6
  4. added this to the 3.9.0 milestone on May 26, 2026
  5. added a commit that references this issue on Jun 5, 2026
    c2ecc8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions