Closed
Description
Minimized example
The test is a version of i8802.scala, with an explicit implicit argument.
trait Foo[A1, B1] {
type Out
}
object Test {
type Bar[A2]
def unit: Bar[Unit] = ???
def product[A3, B3](fst: Bar[A3], snd: Bar[B3])(implicit foo: Foo[A3, B3]): Bar[foo.Out] = ???
implicit def foo[A4]: Foo[A4, Unit] { type Out = A4 } = ???
def check[A5](bar: Bar[A5])(a: A5): Unit = {}
check(product(unit, unit)) // ok
check(product(unit, unit)(summon[Foo[Unit, Unit]]))(()) // error if implicit argument is given explicitly
}
Output
-- [E007] Type Mismatch Error: ../pos/i8802a.scala:17:27 -----------------------
17 | check(product(unit, unit)(summon[Foo[Unit, Unit]]))(()) // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Found: Test.Bar[Unit]
| Required: Test.Bar[(Foo[Unit, Unit] & Singleton)#Out]
longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: ../pos/i8802a.scala:17:54 -----------------------
17 | check(product(unit, unit)(summon[Foo[Unit, Unit]]))(()) // error
| ^^
| Found: Unit
| Required: (Foo[Unit, Unit] & Singleton)#Out
Expectation
Should compile
Metadata
Metadata
Assignees
Labels
No labels