Skip to content

Incorrect dead pure code warning for inline parameters #9751

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
liufengyun opened this issue Sep 8, 2020 · 0 comments
Closed

Incorrect dead pure code warning for inline parameters #9751

liufengyun opened this issue Sep 8, 2020 · 0 comments

Comments

@liufengyun
Copy link
Contributor

liufengyun commented Sep 8, 2020

Minimized code

object Test {
  extension (x: Int)
    inline def times(inline op: Unit): Unit = {
      var count = 0
      while count < x do
        op
        count += 1
    }

  10.times { println("hello") }
}

Output

-- [E129] Potential Issue Warning: examples/times.scala:7:8 --------------------
7 |        op
  |        ^^
  |A pure expression does nothing in statement position; you may be omitting necessary parentheses

Expectation

The compiler should not generate the warning.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 8, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 8, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 9, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 9, 2020
nicolasstucki added a commit that referenced this issue Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants