-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Result of a method call is not accepted when by-name Unit value is expected once default values are used #15898
Labels
Milestone
Comments
Same result if the ctors are switched (in case it was due to nesting level). Works with |
Note: replacing a default parameter value with an overload also compiles fine: object O {
class AC(code: => Unit) {
def apply() = code
def this(code: => Unit, key: Int) = this(code)
def this(code: => Unit, key: Int, modifiers: Int) = this(code)
}
class Doc {
def method: Boolean = true
}
val doc = new Doc
val ac = new AC(doc.method)
} |
The bug is still present on the current nightly ( |
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 4, 2022
When doing a "size-fits" check, we previously only worked with the fact whether the given alternative had default parameters or not. We know count the number of default parameters in the applied parameter section, which gives us a better estimate. Fixes scala#15898
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 4, 2022
When doing a "size-fits" check, we previously only worked with the fact whether the given alternative had default parameters or not. We know count the number of default parameters in the applied parameter section, which gives us a better estimate. Fixes scala#15898
KacperFKorban
added a commit
that referenced
this issue
Sep 4, 2022
) When doing a "size-fits" check, we previously only worked with the fact whether the given alternative had default parameters or not. We know count the number of default parameters in the applied parameter section, which gives us a better estimate. Fixes #15898
mpollmeier
pushed a commit
to mpollmeier/dotty
that referenced
this issue
Oct 16, 2022
When doing a "size-fits" check, we previously only worked with the fact whether the given alternative had default parameters or not. We know count the number of default parameters in the applied parameter section, which gives us a better estimate. Fixes scala#15898
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Compiler version
3.2.0-RC1
Minimized code
Output
See also https://scastie.scala-lang.org/1LhQNKxeQi2WPLlt8o2Cng
Expectation
The code should compile. It compiles when I remove the secondary constructor or when I remove the default value for parameter
modifiers
.Note: the same code compiles fine with Scala 2.12 and 2.13
The text was updated successfully, but these errors were encountered: