Skip to content

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

Closed
@nicolasstucki

Description

@nicolasstucki

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions