Skip to content

Drop support for 1..missing? #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hyrodium opened this issue Apr 2, 2022 · 2 comments
Closed

Drop support for 1..missing? #94

hyrodium opened this issue Apr 2, 2022 · 2 comments

Comments

@hyrodium
Copy link
Collaborator

hyrodium commented Apr 2, 2022

On current master, 1..missing is supported and tested in runtests.jl

@testset "Missing endpoints" begin
@test ismissing(2 in 1..missing)
@test_broken ismissing(2 in missing..1) # would be fixed by julialang#31171
end

julia> 1..missing
1..missing

However, with PR #93, it now returns an error.

julia> 1..missing
ERROR: promotion of types Int64 and Missing failed to change any arguments
Stacktrace:
 [1] error(::String, ::String, ::String)
   @ Base ./error.jl:42
 [2] sametype_error(input::Tuple{Int64, Missing})
   @ Base ./promotion.jl:374
 [3] not_sametype(x::Tuple{Int64, Missing}, y::Tuple{Int64, Missing})
   @ Base ./promotion.jl:368
 [4] promote
   @ ./promotion.jl:351 [inlined]
 [5] (ClosedInterval)(left::Int64, right::Missing)
   @ IntervalSets ~/.julia/dev/IntervalSets/src/interval.jl:30
 [6] ..(x::Int64, y::Missing)
   @ IntervalSets ~/.julia/dev/IntervalSets/src/interval.jl:85
 [7] top-level scope
   @ REPL[6]:1

I propose that 1..missing should return error because this is the same behavior as Base.range.

julia> range(1,missing)
ERROR: MethodError: no method matching (::Colon)(::Int64, ::Missing)
Closest candidates are:
  (::Colon)(::T, ::Any, ::T) where T<:Real at ~/julia/julia-1.7.2/share/julia/base/range.jl:41
  (::Colon)(::A, ::Any, ::C) where {A<:Real, C<:Real} at ~/julia/julia-1.7.2/share/julia/base/range.jl:10
  (::Colon)(::T, ::Any, ::T) where T at ~/julia/julia-1.7.2/share/julia/base/range.jl:40
  ...
Stacktrace:
 [1] range_start_stop(start::Int64, stop::Missing)
   @ Base ./range.jl:144
 [2] _range(start::Int64, step::Nothing, stop::Missing, len::Nothing)
   @ Base ./range.jl:127
 [3] range(start::Int64, stop::Missing; length::Nothing, step::Nothing)
   @ Base ./range.jl:111
 [4] range(start::Int64, stop::Missing)
   @ Base ./range.jl:111
 [5] top-level scope
   @ REPL[3]:1
@hyrodium
Copy link
Collaborator Author

hyrodium commented Apr 2, 2022

x-ref #40 (comment)

@timholy
Copy link
Member

timholy commented Apr 3, 2022

I'd approve of this. (But I think we should have a deprecation.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants