Skip to content

Commit 166031c

Browse files
committed
improve code quality
1 parent 40bb06d commit 166031c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

base/errorshow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function showerror(io::IO, ex::InexactError)
176176
Experimental.show_error_hints(io, ex)
177177
end
178178

179-
typesof(args...) = Tuple{Any[ Core.Typeof(a) for a in args ]...}
179+
typesof(@nospecialize args...) = Tuple{Any[ Core.Typeof(args[i]) for i in 1:length(args) ]...}
180180

181181
function print_with_compare(io::IO, @nospecialize(a::DataType), @nospecialize(b::DataType), color::Symbol)
182182
if a.name === b.name

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,15 @@ end
395395
# Returns the return type. example: get_type(:(Base.strip("", ' ')), Main) returns (String, true)
396396
function try_get_type(sym::Expr, fn::Module)
397397
val, found = get_value(sym, fn)
398-
found && return Base.typesof(val).parameters[1], found
398+
found && return Core.Typeof(val), found
399399
if sym.head === :call
400400
# getfield call is special cased as the evaluation of getfield provides good type information,
401401
# is inexpensive and it is also performed in the complete_symbol function.
402402
a1 = sym.args[1]
403403
if isa(a1,GlobalRef) && isconst(a1.mod,a1.name) && isdefined(a1.mod,a1.name) &&
404404
eval(a1) === Core.getfield
405405
val, found = get_value_getfield(sym, Main)
406-
return found ? Base.typesof(val).parameters[1] : Any, found
406+
return found ? Core.Typeof(val) : Any, found
407407
end
408408
return get_type_call(sym)
409409
elseif sym.head === :thunk
@@ -430,7 +430,7 @@ end
430430

431431
function get_type(sym, fn::Module)
432432
val, found = get_value(sym, fn)
433-
return found ? Base.typesof(val).parameters[1] : Any, found
433+
return found ? Core.Typeof(val) : Any, found
434434
end
435435

436436
# Method completion on function call expression that look like :(max(1))

0 commit comments

Comments
 (0)