-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
parameter constraints in subtype declarations can conflict with the supertype #9441
Labels
types and dispatch
Types, subtyping and method dispatch
Comments
I didn't look at these examples carefully, but it seems like all of the parametric abstract subtyping in Base does not rely on my expectation above goretkin-mbp:julia goretkin$ git grep -P "abstract\s+.+{.+}\s*<:\s*.*{.+}"
base/boot.jl:#abstract DenseArray{T,N} <: AbstractArray{T,N}
base/range.jl:abstract Range{T} <: AbstractArray{T,1}
base/range.jl:abstract OrdinalRange{T,S} <: Range{T}
base/sparse/abstractsparse.jl:abstract AbstractSparseArray{Tv,Ti,N} <: AbstractArray{Tv,N}
examples/lru.jl:abstract LRU{K,V} <: Associative{K,V}
test/core.jl:abstract Qux_{T} <: Sup_{Qux_{Int},T} |
#13297 has a more concise description. |
Another oddness caused by this:
|
#6383 also related |
JeffBezanson
changed the title
abstract subtyping with parameters
parameter constraints in subtype declarations can conflict with the supertype
Jun 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suppose we have the following definitions
For the purposes of this issue I expect the following block of code to work exactly as the above (if you type them each into a different Julia session). Perhaps this is not a justified expectation.
In both sessions, this works as expected
but if you go on to define in each session
then session 1 loops on
Interval(3,4.)
(and any number types) but it works as I expect in session 2.This is consistent with the following
The solution seems to be to be redundant
Furthermore, I think this should raise some kind of red text
because it seems like that type is not able to be constructed
The text was updated successfully, but these errors were encountered: