• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37477

pending completion
#37477

push

local

web-flow
Allow external lattice elements to properly union split (#49030)

Currently `MustAlias` is the only lattice element that is allowed
to widen to union types. However, there are others in external
packages. Expand the support we have for this in order to allow
union splitting of lattice elements.

Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>

26 of 26 new or added lines in 5 files covered. (100.0%)

71476 of 82705 relevant lines covered (86.42%)

34756248.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.46
/stdlib/Dates/src/deprecated.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
using Base: @deprecate, depwarn
4

5
# 1.0 deprecations
6
function (+)(x::AbstractArray{<:TimeType}, y::GeneralPeriod)
5✔
7
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
8
    x .+ y
5✔
9
end
10
function (+)(x::StridedArray{<:GeneralPeriod}, y::TimeType)
×
11
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
12
    x .+ y
×
13
end
14
function (+)(y::GeneralPeriod, x::AbstractArray{<:TimeType})
4✔
15
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
16
    x .+ y
4✔
17
end
18
function (+)(y::TimeType, x::StridedArray{<:GeneralPeriod})
×
19
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
20
    x .+ y
×
21
end
22
function (-)(x::AbstractArray{<:TimeType}, y::GeneralPeriod)
4✔
23
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
24
    x .- y
4✔
25
end
26
function (-)(x::StridedArray{<:GeneralPeriod}, y::TimeType)
×
27
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
28
    x .- y
×
29
end
30

31
# TimeType, AbstractArray{TimeType}
32
function (-)(x::AbstractArray{T}, y::T) where {T<:TimeType}
2✔
33
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
34
    x .- y
2✔
35
end
36
function (-)(y::T, x::AbstractArray{T}) where {T<:TimeType}
2✔
37
    # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
38
    y .- x
2✔
39
end
40

41
for (op, Ty, Tz) in ((:*, Real, :P),
42
                   (:/, :P, Float64), (:/, Real, :P))
43
    @eval begin
44
        function ($op)(X::StridedArray{P}, y::$Ty) where P<:Period
×
45
            # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
46
            Z = similar(X, $Tz)
×
47
            for (Idst, Isrc) in zip(eachindex(Z), eachindex(X))
×
48
                @inbounds Z[Idst] = ($op)(X[Isrc], y)
×
49
            end
×
50
            return Z
×
51
        end
52
    end
53
end
54

55
function (+)(x::StridedArray{<:GeneralPeriod})
×
56
    # depwarn("non-broadcasted operations are deprecated for Dates.TimeType; use broadcasting instead", nothing)
57
    x
×
58
end
59

60
for op in (:+, :-)
61
    @eval begin
62
        function ($op)(X::StridedArray{<:GeneralPeriod}, Y::StridedArray{<:GeneralPeriod})
×
63
            # depwarn("non-broadcasted arithmetic is deprecated for Dates.TimeType; use broadcasting instead", nothing)
64
            reshape(CompoundPeriod[($op)(x, y) for (x, y) in zip(X, Y)], promote_shape(size(X), size(Y)))
×
65
        end
66
    end
67
end
68

69
@deprecate argerror(msg::String) ArgumentError(msg) false
70
@deprecate argerror() nothing false
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc