diff --git a/base/replutil.jl b/base/replutil.jl index bcd52f5e886c2..609b81609b984 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -13,6 +13,10 @@ function writemime(io::IO, ::MIME"text/plain", f::Function) print(io, ns, " (", what, " with $n $m)") end +function writemime(io::IO, ::MIME"text/plain", f::Builtin) + print(io, typeof(f).name.mt.name, " (built-in function)") +end + # writemime for ranges, e.g. # 3-element UnitRange{Int64,Int} # 1,2,3 diff --git a/src/toplevel.c b/src/toplevel.c index 057e51c1d37ab..6f19ff2d673a1 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -781,6 +781,9 @@ JL_DLLEXPORT void jl_method_def(jl_svec_t *argdata, jl_lambda_info_t *f, jl_valu mt = ((jl_datatype_t*)ftype)->name->mt; name = mt->name; + if (jl_subtype(ftype, jl_builtin_type, 0)) + jl_error("cannot add methods to a builtin function"); + jl_check_static_parameter_conflicts(f, tvars, name); // TODO