-
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.
Browse files
Browse the repository at this point in the history
The problem lied with slightly adjusted unapply of FunctionOf in a previous PR, which caused different behavior in `resolveOverloaded`, where due to a pattern match into a FunctionOf `resolveOverloaded1` would return no candidates, causing more issues later on. To keep the new behavior of FunctionOf unapply (which as a side-effect ended up fixing few issues represented with added tests), with the previous behavior of overloaded functions, we allow the method candidate filtering to fallback from the FunctionOf candidate filtering into the previous behavior in case no candidates are kept. This also fixes an additional case, which is not part of the regression, but produces an incorrect error in similar manner. Fixes #17245
- Loading branch information
Showing
2 changed files
with
48 additions
and
24 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,20 @@ | ||
import scala.reflect.ClassTag | ||
|
||
trait MockSettings | ||
|
||
object Mockito { | ||
def mock[T : ClassTag]: T = ??? | ||
def mock[T : ClassTag](settings: MockSettings): T = ??? | ||
} | ||
|
||
trait Channel | ||
type OnChannel = Channel => Any | ||
|
||
@main def Test = | ||
val case1: OnChannel = Mockito.mock[OnChannel] | ||
val case2: OnChannel = Mockito.mock | ||
val case3 = Mockito.mock[OnChannel] | ||
val case4: OnChannel = Mockito.mock[OnChannel](summon[ClassTag[OnChannel]]) | ||
|
||
// not a regressive case, but an added improvement with the fix for the above | ||
val case5: Channel => Any = Mockito.mock[Channel => Any] |