Skip to content

Export synthetic case class companion's apply with default parameter as extension #18715

Closed
@prolativ

Description

@prolativ

Compiler version

3.2.0, 3.4.0-RC1-bin-20231017-af6a2ef-NIGHTLY

Minimized code

case class Foo(x: Int = 0)

extension (x: Any)
  private def foo = Foo
  export foo.apply

Output

Error: Unexpected error when compiling T_3200b05eac-3b992a6ee3: 'assertion failed: foo does not have a default getter named apply$default$1'

Expectation

This should compile as it does when apply is defined explicitly in the companion object of a class, e.g.

case class Foo(x: Int = 0)
object Foo:
  def apply(x: Int = 0) = new Foo(x)

extension (x: Any)
  private def foo = Foo
  export foo.apply

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions