i've narrowed down issue following minimal (non-)working example:
class z trait a[e <: z] { type t[x <: e] <: a[x] } trait b[e <: z] extends a[e] { type t[x <: e] <: b[x] } trait c[e <: z, f[x <: z] <: c[x, f]] extends a[e] { type t[x <: e] = f[x] } class d[e <: z] extends b[e] c[e, d]
it sort of higher-kinded f-bounded polymorphism (i'm using t[e] return value of methods). when try compile code get:
error: overriding type t in trait b bounds[x <: e] <: b[x]; type t in trait c, equals [x <: e]d[x] has incompatible type
however, given d
sub-type of b
, same e
passed b
, c
, types shouldn't incompatible. martin odersky explained in question when merging member in mixin, there 2 rules: 1) concrete on abstract , 2) linearisation order. in case both "concrete" types go 2). linearisation order says c
should win on b
, i'm left wondering i'm getting wrong here.
Comments
Post a Comment