Closed
Description
Compiler version
3.0.0-RC3
Minimized code
def fst[A, B[_]]: (a: A) => (b: B[a.type]) => a.type =
(a: A) => (b: B[a.type]) => a
def snd[A, B[_]]: (a: A) => (b: B[a.type]) => b.type =
(a: A) => (b: B[a.type]) => b
Output
-- [E007] Type Mismatch Error: test.scala:2:12 ---------------------------------
2 | (a: A) => (b: B[a.type]) => a
| ^^^^^^^^^^^^^^^^^^^
| Found: B[(a : A)] => A
| Required: (b: Nothing) => A & (b: B[(a : A)]) => (a : A)
|
| where: B is a type in method fst with bounds <: [_$1] =>> Any
longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: test.scala:5:12 ---------------------------------
5 | (a: A) => (b: B[a.type]) => b
| ^^^^^^^^^^^^^^^^^^^
| Found: B[(a : A)] => B[(a : A)]
| Required: (b: Nothing) => Any & (b: B[(a : A)]) => b.type
|
| where: B is a type in method snd with bounds <: [_$2] =>> Any
longer explanation available when compiling with `-explain`
2 errors found
Expectation
The code should compile, as the bodies conform to the type signatures.
Also, I haven't found any way of creating an instance of a dependent function type like (a: A) => (b: B[a.type]) => a.type
above.