Dispatch on constrained value type parameters

Would this be just as efficient?

function foo(x1::AbstractArray{T1, N1}, x2::AbstractArray{T2, N2}) where {T1, T2, N1, N2}
    N1 == 2*N2 || error("x1 should have twice as many dimensions as x2")
    return x1
end

If so it seems simpler, avoiding intermediate _foo trait or using a generated function.