diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 62547c8d7e01b..9f0ae669caaca 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -1190,13 +1190,13 @@ mightalias(A::AbstractArray, B::AbstractArray) = !isbits(A) && !isbits(B) && !_i mightalias(x, y) = false _isdisjoint(as::Tuple{}, bs::Tuple{}) = true -_isdisjoint(as::Tuple{}, bs::Tuple{Any}) = true +_isdisjoint(as::Tuple{}, bs::Tuple{UInt}) = true _isdisjoint(as::Tuple{}, bs::Tuple) = true -_isdisjoint(as::Tuple{Any}, bs::Tuple{}) = true -_isdisjoint(as::Tuple{Any}, bs::Tuple{Any}) = as[1] != bs[1] -_isdisjoint(as::Tuple{Any}, bs::Tuple) = !(as[1] in bs) +_isdisjoint(as::Tuple{UInt}, bs::Tuple{}) = true +_isdisjoint(as::Tuple{UInt}, bs::Tuple{UInt}) = as[1] != bs[1] +_isdisjoint(as::Tuple{UInt}, bs::Tuple) = !(as[1] in bs) _isdisjoint(as::Tuple, bs::Tuple{}) = true -_isdisjoint(as::Tuple, bs::Tuple{Any}) = !(bs[1] in as) +_isdisjoint(as::Tuple, bs::Tuple{UInt}) = !(bs[1] in as) _isdisjoint(as::Tuple, bs::Tuple) = !(as[1] in bs) && _isdisjoint(tail(as), bs) """ diff --git a/base/broadcast.jl b/base/broadcast.jl index defd53aff6adf..913111e6481c2 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -555,7 +555,7 @@ Base.@propagate_inbounds _newindex(ax::Tuple{}, I::Tuple{}) = () @inline function _newindexer(indsA::Tuple) ind1 = indsA[1] keep, Idefault = _newindexer(tail(indsA)) - (Base.length(ind1)!=1, keep...), (first(ind1), Idefault...) + (Base.length(ind1)::Integer != 1, keep...), (first(ind1), Idefault...) end @inline function Base.getindex(bc::Broadcasted, I::Union{Integer,CartesianIndex}) diff --git a/base/namedtuple.jl b/base/namedtuple.jl index 790a080bd4129..17f1d9c38684a 100644 --- a/base/namedtuple.jl +++ b/base/namedtuple.jl @@ -64,7 +64,7 @@ Core.NamedTuple if nameof(@__MODULE__) === :Base @eval function NamedTuple{names,T}(args::Tuple) where {names, T <: Tuple} - if length(args) != length(names) + if length(args) != length(names::Tuple) throw(ArgumentError("Wrong number of arguments to named tuple constructor.")) end # Note T(args) might not return something of type T; e.g. @@ -251,8 +251,8 @@ julia> merge((a=1, b=2, c=3), [:b=>4, :d=>5]) function merge(a::NamedTuple, itr) names = Symbol[] vals = Any[] - inds = IdDict() - for (k,v) in itr + inds = IdDict{Symbol,Int}() + for (k::Symbol, v) in itr oldind = get(inds, k, 0) if oldind > 0 vals[oldind] = v diff --git a/base/ntuple.jl b/base/ntuple.jl index 0967066f3447e..1fdbc016ee39d 100644 --- a/base/ntuple.jl +++ b/base/ntuple.jl @@ -55,12 +55,13 @@ ntuple(f, ::Val{3}) = (@_inline_meta; (f(1), f(2), f(3))) end end -@inline function fill_to_length(t::Tuple, val, ::Val{N}) where {N} +@inline function fill_to_length(t::Tuple, val, ::Val{_N}) where {_N} M = length(t) + N = _N::Int M > N && throw(ArgumentError("input tuple of length $M, requested $N")) if @generated quote - (t..., $(fill(:val, N-length(t.parameters))...)) + (t..., $(fill(:val, (_N::Int) - length(t.parameters))...)) end else (t..., fill(val, N-M)...) diff --git a/base/reflection.jl b/base/reflection.jl index c2a8f4d0bc95f..813ab0f4bc1ee 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -147,7 +147,7 @@ function fieldname(t::DataType, i::Integer) throw(ArgumentError("type does not have definite field names")) end names = _fieldnames(t) - n_fields = length(names) + n_fields = length(names)::Int field_label = n_fields == 1 ? "field" : "fields" i > n_fields && throw(ArgumentError("Cannot access field $i since type $t only has $n_fields $field_label.")) i < 1 && throw(ArgumentError("Field numbers must be positive integers. $i is invalid.")) diff --git a/base/show.jl b/base/show.jl index e97a1eda9756c..22ff592ace180 100644 --- a/base/show.jl +++ b/base/show.jl @@ -523,7 +523,7 @@ end function show_datatype(io::IO, x::DataType) istuple = x.name === Tuple.name if (!isempty(x.parameters) || istuple) && x !== Tuple - n = length(x.parameters) + n = length(x.parameters)::Int # Print homogeneous tuples with more than 3 elements compactly as NTuple{N, T} if istuple && n > 3 && all(i -> (x.parameters[1] === i), x.parameters)