§2.3.2.(e) Generic declared lifting

A method with declared lifting may introduce a type parameter that is bounded relative to a given role type. Such bound is declared as:

<AnyBase base SuperRole>
void teamMethod(AnyBase as SuperRole arg) {
   // body using arg as of type SuperRole
}

This means that AnyBase is a type parameter whose instantiations must all be liftable to role SuperRole.

The given type bound requires the call site to supply an argument that is compatible to any base class for which the current team contains a bound role that is a sub class of SuperRole, including SuperRole itself. However, SuperRole itself need not be bound to any base class. On the other hand, different valid substitutions for AnyBase need not be related by inheritance.

Note:
This feature supports generalized treatment of otherwise unrelated base classes. This is done by defining one bound role for each base under consideration and by having all these roles extend a common unbound role.