type argument inference for #518