-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:typeritype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.2.0
Minimized code
sealed trait NatT
final case class Zero() extends NatT
final case class Succ[N <: NatT](n: N) extends NatT
type _0 = Zero
type _1 = Succ[_0]
given Zero = Zero()
given [N <: NatT](using n: N): Succ[N] = Succ(n)
// a variant for the previous line leading to a different error message:
// given Succ[Zero] = Succ(Zero())
trait Mixin
class Instance[N <: NatT](using N)
trait Container[N <: NatT]:
def instance: Instance[N]
class Refined extends Container[_1]:
def instance: Instance[_1] & Mixin = new Instance() with Mixin
Compiler output
Found: Instance[Zero] with Mixin {...}
Required: Instance[_1] & Mixin
Expectation
No compiler error.
The code does compile when the last line is changed to
def instance: Instance[_1] & Mixin = new Instance[_1]() with Mixin
or when there is no mixin.
For more complex code, I've seen errors due to this that are impossible to decipher, as they wrongly assert that other using
parameters are missing. Unfortunately, they are hard to reproduce with a small piece of code.
Metadata
Metadata
Assignees
Labels
area:typeritype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label