public class HandlerRegistrationSource : IRegistrationSource
public IEnumerable<IComponentRegistration> RegistrationsFor(
Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
var swt = service as IServiceWithType;
if(swt == null || !typeof(BaseClass).IsAssignableFrom(swt.ServiceType))
// It's not a request for the BaseClass type, so skip it.
var registration = new ComponentRegistration(
new DelegateActivator(swt.ServiceType, (c, p) =>
var myService = c.Resolve<IService>();
may help you . You would like the compiler to consider lexical.Scanner and mylexical.Scanner as equal, based on the fact that at runtime, the value of mylexical and lexical is always the same. This is a run-time property, and the type checker doesn't do any data-flow analysis (that would be way too slow to be practical). So you need to help the type checker by telling it that the two values are always the same. You can do that by using a singleton type. A singleton type is a type that has exactly one value, and is written as (in this case) lexical.type.
val mylexical: lexical.type = lexical
Scala: Re-use generic resulting from path-dependent type in path-dependent context
I hope this helps you . No this is not possible. Generic class level type parameters need to be defined if you wish to use them anywhere inside the class. You are trying to define T0 in terms of ClassA with type parameters that are not part of the ClassB definition so obviously it won't compile. You could do something like: