@@ -107,9 +107,6 @@ include("options.jl")
107107include (" promotion.jl" )
108108include (" tuple.jl" )
109109include (" expr.jl" )
110- Pair {A, B} (@nospecialize (a), @nospecialize (b)) where {A, B} = (@inline ; Pair {A, B} (convert (A, a):: A , convert (B, b):: B ))
111- # Pair{Any, B}(@nospecialize(a::Any), b) where {B} = (@inline; Pair{Any, B}(a, Base.convert(B, b)::B))
112- # Pair{A, Any}(a, @nospecialize(b::Any)) where {A} = (@inline; Pair{A, Any}(Base.convert(A, a)::A, b))
113110include (" pair.jl" )
114111include (" traits.jl" )
115112include (" range.jl" )
@@ -125,6 +122,13 @@ include("pointer.jl")
125122include (" refvalue.jl" )
126123include (" refpointer.jl" )
127124
125+ # now replace the Pair constructor (relevant for NamedTuples) with one that calls our Base.convert
126+ delete_method (which (Pair{Any,Any}, (Any, Any)))
127+ @eval function (P:: Type{Pair{A, B}} )(@nospecialize (a), @nospecialize (b)) where {A, B}
128+ @inline
129+ return $ (Expr (:new , :P , :(convert (A, a)), :(convert (B, b))))
130+ end
131+
128132# The REPL stdlib hooks into Base using this Ref
129133const REPL_MODULE_REF = Ref {Module} ()
130134
429433for m in methods (include)
430434 delete_method (m)
431435end
436+
432437# These functions are duplicated in client.jl/include(::String) for
433438# nicer stacktraces. Modifications here have to be backported there
434439include (mod:: Module , _path:: AbstractString ) = _include (identity, mod, _path)
0 commit comments