-
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.
Keep HasDefault flag updated in overriding methods
Fixes #16006 #16006 started failing since we now count the number of default parameters for better precision in overloading resolution. But that count was wrong since it did not take inherited default getters from overridden methods into account. We fix this by setting the HasDefault flag also for parameters that don't have a default value themselves, but that correspond to parameters with default values in overridden methods.
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 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 @@ | ||
overriden (3, 10) |
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,11 @@ | ||
class X: | ||
def toString(maxLines: Int = 10, maxWidth: Int = 10): String = (maxLines -> maxWidth).toString | ||
|
||
class Foo extends X: | ||
override def toString(maxLines: Int, maxWidth: Int): String = s"overriden ($maxLines, $maxWidth)" | ||
override def toString(): String = toString(maxLines = 3) | ||
|
||
|
||
@main def Test = { | ||
println(Foo().toString()) | ||
} |