-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine estimation of default arguments in overloading resolution
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
- Loading branch information
Showing
3 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
object O { | ||
class AC(code: => Unit) { | ||
def apply() = code | ||
|
||
def this(code: => Unit, key: Int = 1, modifiers: Int = 0) = { | ||
this(code) | ||
} | ||
} | ||
|
||
class Doc { | ||
def method: Boolean = true | ||
} | ||
|
||
val doc = new Doc | ||
|
||
val ac = new AC(doc.method) // error | ||
|
||
def foo[T](code: => Unit): Unit = () | ||
def foo[T](code: => Unit, key: Int = 1, modifiers: Int = 0): Unit = foo(code) | ||
foo(doc.method) // error | ||
foo[Int](doc.method) // error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
object O { | ||
class AC(code: => Unit) { | ||
def apply() = code | ||
|
||
def this(code: => Unit, key: Int, modifiers: Int = 0) = { | ||
this(code) | ||
} | ||
} | ||
|
||
class Doc { | ||
def method: Boolean = true | ||
} | ||
|
||
val doc = new Doc | ||
|
||
val ac = new AC(doc.method) | ||
|
||
def foo[T](code: => Unit): Unit = () | ||
def foo[T](code: => Unit, key: Int, modifiers: Int = 0): Unit = foo(code) | ||
foo(doc.method) | ||
foo[Int](doc.method) | ||
} |