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

Exporting extension methods drops default arguments #14159

Closed
dcascaval opened this issue Dec 21, 2021 · 1 comment
Closed

Exporting extension methods drops default arguments #14159

dcascaval opened this issue Dec 21, 2021 · 1 comment

Comments

@dcascaval
Copy link

Compiler version

3.1.0 (this also reproduces on the latest nightly as of 12/20)

Minimized code

object api:
  export impl.*

object impl:
  class Bar
  extension (rcv: Bar)
    def foo(a: Int) = ()
    def bar(a: Int, b: Boolean = false) = ()

object Test1:
  import api.*
  val value = (new Bar).bar(0) // Error

object Test2:
  import impl.*
  val value = (new Bar).bar(0) // Works

object Test3:
  import api.*
  val value = (new Bar).foo(0) // Works

Output

[error] 12 |  val value = (new Bar).bar(0) // Missing argument
[error]    |              ^^^^^^^^^^^^^^^^
[error]    |missing argument for parameter b of method bar in object api: (a: Int, b: Boolean): Unit

Expectation

Hit this case when exporting extension method through a facade object api from an implementation object impl. Since exporting normal extension methods (e.g. foo) works, I would also expect the method bar to export such that it can be called omitting the second argument and having it be filled in by the default.

@smarter
Copy link
Member

smarter commented Dec 21, 2021

3.1.0 (this also reproduces on the latest nightly as of 12/20)

I can't reproduce this with 3.1.2-RC1-bin-20211220-0b55c7d-NIGHTLY, this looks like it was fixed in #14051

@smarter smarter closed this as completed Dec 21, 2021
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