diff --git a/base/boot.jl b/base/boot.jl index 86ec4f346ef42..bd554672e4ff7 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -226,6 +226,10 @@ ccall(:jl_toplevel_eval_in, Any, (Any, Any), (f::typeof(Typeof))(x) = ($(_expr(:meta,:nospecialize,:x)); isa(x,Type) ? Type{x} : typeof(x)) end) +# let the compiler assume that calling Union{} as a constructor does not need +# to be considered ever (which comes up often as Type{<:T}) +Union{}(a...) = throw(MethodError(Union{}, a)) + macro nospecialize(x) _expr(:meta, :nospecialize, x) end