Closed
Description
Compiler version
3.3.1-RC1-nighlty
Last good release: 3.3.1-RC1-bin-20230302-8020c77-NIGHTLY
First bad release: 3.3.1-RC1-bin-20230303-6ad22aa-NIGHTLY
The commit-based bisect for range of commits 8020c77..6ad22aa failed due to other failures.
Minimized code
Based on Open CB failures in pjfanning/akka-rabbitmq, compilation logs can be found here: https://github.com/VirtusLab/community-build3/actions/runs/4650721329/jobs/8229907414
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 fail1: OnChannel = Mockito.mock[OnChannel] // fails
val fail2: OnChannel = Mockito.mock // fails
val workaround1 = Mockito.mock[OnChannel] // compiles
val workaround2: OnChannel = Mockito.mock[OnChannel](summon[ClassTag[OnChannel]]) // compiles
Output
-- [E134] Type Error: /workspace/dotty/bisect/main.scala:14:33 -----------------
14 | val fail1: OnChannel = Mockito.mock[OnChannel] // fails
| ^^^^^^^^^^^^
|None of the overloaded alternatives of method mock in object Mockito with types
| [T](settings: MockSettings)(implicit evidence$2: reflect.ClassTag[T]): T
| [T](implicit evidence$1: reflect.ClassTag[T²]): T²
|match type arguments [OnChannel] and expected type OnChannel
|
|where: T is a type variable
| T² is a type variable
-- [E134] Type Error: /workspace/dotty/bisect/main.scala:15:33 -----------------
15 | val fail2: OnChannel = Mockito.mock // fails
| ^^^^^^^^^^^^
|None of the overloaded alternatives of method mock in object Mockito with types
| [T](settings: MockSettings)(implicit evidence$2: reflect.ClassTag[T]): T
| [T](implicit evidence$1: reflect.ClassTag[T²]): T²
|match expected type OnChannel
|
|where: T is a type variable
| T² is a type variable
2 errors found
Expectation
Compiler should pick def mock[T : ClassTag]: T
and allow for compilation