Reviewed-by: darcy
Reviewed-by: ohair
Types.adapt should avoid infinite loops by exploiting a local cache Reviewed-by: jjg