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

Beta-reduction of function type with by-name argument #20095

Closed
nicolasstucki opened this issue Apr 5, 2024 · 0 comments · Fixed by #20096
Closed

Beta-reduction of function type with by-name argument #20095

nicolasstucki opened this issue Apr 5, 2024 · 0 comments · Fixed by #20096
Assignees
Milestone

Comments

@nicolasstucki
Copy link
Contributor

Compiler version

a7f00e2 (main)

Minimized code

//> using option -Xprint:inlining

inline def twice(inline thunk: =>Unit): Unit =
  thunk
  thunk

inline def pipe(inline t: =>Unit, inline f: (=>Unit) => Unit): Unit = f(t)

@main def test =
  pipe(println("foo"), twice)

Output

@main def test: Unit =
      {
        val thunk: Unit = println("foo")
        {
          thunk
          thunk
        }:Unit
      }:Unit

Expectation

@main def test: Unit =
      {
        def thunk: Unit = println("foo")
        {
          thunk
          thunk
        }:Unit
      }:Unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants