You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this following code the overridden declaration of fact in Iterable makes type inference fail for g and h The version in f where the additional type information is deliberately dropped, compiles successfully.
If r is a stable identifier of type T, the selection r.x refers statically to a term member m of r that is identified in T by the name x.
The type of a designator is the type T of the entity it refers to [which I think, from context, must be m]
The selection's result is then the member of r that is either defined by m or defined by a definition overriding m.
If a declaration or definition overrides a declaration or definition in one of the component types T1,…,Tn, the usual rules for overriding apply
Finally, the rules for overriding say that:
A member M of class C that matches a non-private member M′ of a base class of C is said to override that member. In this case the binding of the overriding member M must subsume the binding of the overridden member M′.
I'd say that Iterable[_].fact does not subsume IterableOps[CC].fact at the location of the compound type Iterable[_] with IterableOps[CC]. OTOH, the spec talks about the binding of Iterable[_].fact, which does subsume the binding of IterableOps[CC].fact.
In this following code the overridden declaration of
fact
inIterable
makes type inference fail forg
andh
The version inf
where the additional type information is deliberately dropped, compiles successfully.This fails to compile (tested with Scala 2.12.2, 2.12.4 and 2.13.0-M3) with:
It works in Dotty (current master branch).
The text was updated successfully, but these errors were encountered: