-
-
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
new subtyping issues #19998
Comments
Is this a list of 0.6-blocking issues? |
no, it's a summary of bugs that won't be fixed by #18457 |
That doesn't really answer my question. |
It's a list of things he found while reviewing #18457 that don't block merging it. These are generally minor bugs or follow-on work items that don't block 0.6. |
We really shouldn't leave the ambiguity test turned off for very long though. That's the most urgent of these to fix. |
whoever added "add test cases for all closed issues", can you list the issues that still need test-cases so we can cross them off as we go? @tkelman there's no ordering in the above list, just a task list to keep track of everything |
Jeff is the one closing them, I've been grepping the test folder for references to each of them but haven't found any hits. (except 18450 and 11840) edit: any of these cases that are covered by existing tests, should at least cross-reference the relevant issue in a comment / testset description |
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721 Enabled tests for JuliaLang#11840
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721 Enabled tests for JuliaLang#11840
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721 Enabled tests for JuliaLang#11840
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721 Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved yet but needs tests triggering it.
I found that you can't do let T = TypeVar{:T}
subtypes(Type{T})
end works. EDIT: NVM, I think that is covered by the first item on the list. |
@pabloferz See also #20086 and #20084 (if you want |
Is the following expected? julia> Array{NTuple{N, Int} where N} <: (Array{NTuple{N, T} where N}) where T
true
julia> Array{NTuple{N, Integer} where N} <: (Array{NTuple{N, T} where N}) where T
false I would expect that, since the |
Yes. On the left, each element of the tuple can be any subtype of Integer. On the right, each element of the tuple must be the same subtype of Any. |
What do you mean by each element of the tuple ranging over any subtype of |
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721 For JuliaLang#11803 it was decidided that no tests are needed. Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved yet but needs new tests triggering it.
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721 For JuliaLang#11803 it was decidided that no tests are needed. Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved yet but needs new tests triggering it.
note that we can coerce that "subtype environment sub-optimality preventing a dispatch match" further to convince it to give other (related) bad answers for other leaftypes: julia> A = Tuple{Ref{Tuple{T}}, T} where T;
julia> B = Tuple{Ref{Tuple{VecElement{S}} where S}, VecElement{Int}};
julia> ccall(:jl_match_method, Any, (Any, Any), B, A)
svec(Tuple{Ref{Tuple{VecElement{S}} where S}, VecElement{Int64}},
svec(VecElement{Int64})) # expected `VecElement`
julia> A = Tuple{Ref{Tuple{T}}, T, T} where T;
julia> B = Tuple{Ref{Tuple{VecElement{S}} where S}, VecElement{Int}, VecElement{Float64}};
julia> ccall(:jl_match_method, Any, (Any, Any), B, A)
svec(Tuple{Ref{Tuple{VecElement{S}} where S}, VecElement{Int64}, VecElement{Float64}},
svec(Union{VecElement{Float64}, VecElement{Int64}})) # expected `VecElement`
julia> A = Pair{Ref{Tuple{T}}, T} where T;
julia> B = Pair{Ref{Tuple{VecElement} where S}, VecElement};
julia> ccall(:jl_match_method, Any, (Any, Any), B, A)
svec(Pair{Ref{Tuple{VecElement{S}} where S}, VecElement},
svec(Union{VecElement, VecElement{S}})) # expected `VecElement` |
alright, I've finally managed to turn that incorrect environment into a subtyping error, and updated the top issue with the example |
julia> immutable B{T}
a::T
end
julia> B
B # used to be B{T} Is this intentional or a regression? If the former, what is the preferred way get this information? |
julia> Array
Array
julia> Base.unwrap_unionall(Array)
Array{T,N} |
I do agree though that the printing for general UnionAlls needs to be revised to show the type parameters. |
I had a look at the show method Line 185 in 06fa32c
|
Example? Type parameters are certainly shown in general. I decided to show types like |
I don't worry too much about this one. I don't think subtyping should be expected to enumerate possible values of unionall variables. I agree we can and should normalize |
in the second case, it could be undesirable since it could make the first case doesn't have that issue, so I agree that it's not as likely to be a problem. |
As this is a meta-issue tracking issues in the new type system, referencing #20324 here. |
I've been pointed here for a strange error in StaticArrays. The most alarming thing (to me) is that dispatch is not deterministic, in the sense that calling method "A", constructing some object "B", and then calling the method "A" again results in a different (and incorrect) dispatch; see JuliaArrays/StaticArrays.jl#106 (comment). If someone could let me know if this error appears related to the things here or is orthogonal, I would appreciate it. |
julia> Tuple{Tuple{Int64},Int64} <: NTuple{N} where N
false
julia> Tuple{Int64,Tuple{Int64}} <: NTuple{N} where N
false Didn't read the NEWS
|
NTuple's have to be homogenous now - if that's not mentioned clearly enough in news then we should clarify it |
Added PR #20627 with tests for #2552, #8625, #8915, #11407 (off the bottom of the list) |
Added tests for #12814 #16922 #17943 #18892 #19159 #19413 #19041 #18985 to #20627 If these are correct, this ticks off all the "add test case"s on the list so far |
On the |
Also added a request to document the type-system parameter matching, as this is a current source of bugs in the inference results (such as #20847) and subtyping errors (already listed above). |
I did some fuzzing where I verified that for types
Here are some problematic cases I hit: julia> versioninfo()
Julia Version 0.6.0-pre.alpha.142
Commit 64409a0cae* (2017-03-14 04:20 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
julia> let a = Tuple{Float64,T7} where T7,
b = Tuple{S5,Tuple{S5}} where S5,
x = Tuple{Float64,Tuple{Float64}}
typeintersect(a, b) <: b
end
false
julia> let a = Tuple{T1,T1} where T1,
b = Tuple{Val{S2},S6} where S2 where S6,
x = Tuple{Val{Float64},Val{Float64}}
typeintersect(a, b) == typeintersect(b, a)
end
false
julia> let a = Val{Tuple{T1,T1}} where T1,
b = Val{Tuple{Val{S2},S6}} where S2 where S6,
x = Val{Tuple{Val{Float64},Val{Float64}}}
typeintersect(a, b) <: a
end
false # true since #21295
julia> let a = Tuple{Float64,T3,T4} where T4 where T3,
b = Tuple{S2,Tuple{S3},S3} where S2 where S3,
x = Tuple{Float64,Tuple{1},1}
typeintersect(a, b) == typeintersect(b, a)
end
false
julia> let a = Tuple{T1,Tuple{T1}} where T1,
b = Tuple{Float64,S3} where S3,
x = Tuple{Float64,Tuple{Float64}}
typeintersect(a, b) <: a
end
false
julia> let a = Tuple{5,T4,T5} where T4 where T5,
b = Tuple{S2,S3,Tuple{S3}} where S2 where S3,
x = Tuple{5,Float64,Tuple{Float64}}
typeintersect(a, b) == typeintersect(b, a)
end
false
julia> let a = Tuple{T2,Tuple{T4,T2}} where T4 where T2,
b = Tuple{Float64,Tuple{Tuple{S3},S3}} where S3,
x = Tuple{Float64,Tuple{Tuple{Float64},Float64}}
typeintersect(a, b) <: b
end
false
julia> let a = Tuple{Tuple{T2,4},T6} where T2 where T6,
b = Tuple{Tuple{S2,S3},Tuple{S2}} where S2 where S3,
x = Tuple{Tuple{Int64,4},Tuple{Int64}}
typeintersect(a, b) == typeintersect(b, a)
end
false
julia> let a = Tuple{T3,Int64,Tuple{T3}} where T3,
b = Tuple{S3,S3,S4} where S4 where S3,
x = Tuple{Int64,Int64,Tuple{Int64}}
typeintersect(a, b) <: a
end
false
julia> let a = Tuple{T1,Val{T2},T2} where T2 where T1,
b = Tuple{Float64,S1,S2} where S2 where S1,
x = Tuple{Float64,Val{Int64},Int64}
typeintersect(a, b) == typeintersect(b, a)
end
false
julia> let a = Tuple{T1,Val{T2},T2} where T2 where T1,
b = Tuple{Float64,S1,S2} where S2 where S1,
x = Tuple{Float64,Val{Int64},Int64}
typeintersect(a, b) <: a
end
false
julia> let a = Tuple{Float64,T1} where T1,
b = Tuple{S1,Tuple{S1}} where S1,
x = Tuple{Float64,Tuple{Float64}}
typeintersect(a, b) <: b
end
false
julia> let a = Tuple{Val{T1},T2,T2} where T2 where T1,
b = Tuple{Val{Tuple{S2}},S3,Float64} where S2 where S3,
x = Tuple{Val{Tuple{4}},Float64,Float64}
typeintersect(a, b) == typeintersect(b, a)
end
false # true since #21295
julia> let a = Tuple{Val{T1},T2,T2} where T2 where T1,
b = Tuple{Val{Tuple{S2}},S3,Float64} where S2 where S3,
x = Tuple{Val{Tuple{4}},Float64,Float64}
x <: typeintersect(a, b)
end
false # true since #21295
julia> let a = Tuple{T1,T2,T2} where T1 where T2,
b = Tuple{Val{S2},S2,Float64} where S2,
x = Tuple{Val{Float64},Float64,Float64}
x <: typeintersect(a, b)
end
false
julia> let a = Val{Tuple{T1,Val{T2},Val{Int64},Tuple{Tuple{T3,5,Float64},T4,T2,T5}}} where T1 where T5 where T4 where T3 where T2,
b = Val{Tuple{Tuple{S1,5,Float64},Val{S2},S3,Tuple{Tuple{Val{Float64},5,Float64},2,Float64,S4}}} where S2 where S3 where S1 where S4
typeintersect(b, a)
end
ERROR: StackOverflowError:
Stacktrace:
[1] typeintersect(::Any, ::Any) at ./reflection.jl:305 (Unless I'm mistaken, these should all give Should I open a dedicated issue for tracking those? |
I was going back through and reviewing the OP here. There's still many that don't have confirmed tests, but are fixed now (the corresponding issue is closed). In the above comment, all of those return
|
these are issues found with subtyping after #18457, and other related punchlist items.
subtype
in typetree (currently switched to@test_broken
) grabbag of subtyping punchlist items #20407(tparam ? jl_isa(t, ty) : jl_subtype(t, ty))
grabbag of subtyping punchlist items #20407show
grabbag of subtyping punchlist items #20407typeintersect(ml->sig, types) <: ml->sig
grabbag of subtyping punchlist items #20407check_ambiguous_visitor
grabbag of subtyping punchlist items #20407::Kind
queries get cached correctlydoc/src/manual/types.md
that "Float does not exist as a typealias for Float64, since the size of the floating point number is problem dependent, not platform dependent" grabbag of subtyping punchlist items #20407>:
function (issupertype
) grabbag of subtyping punchlist items #20407where
appearing in a Type in a method errorjulia> convert(Type{T} where T<:Int, 1)
ERROR: MethodError: Cannot
convert
an object of type Int64 to an object of type Type{T} where T<:Int64This may have arisen from a call to the constructor Type{T} where T<:Int64(...),
since type constructors fall back to convert methods.
UNION_SPLIT_MISMATCH_ERROR
from inferenceprecise_container_types
(it calls unwrap, but not re-wrap)Tuple{Vararg}
, or making Vararg not a typemethods
returns wrong result for triangular dispatch #18348 (done in Misc tests for issues fixed by jb/subtype #20097)Int{}
should be an error #17943#18457 (comment)
This overflows the union state stack.
a possibly related case is:
Vector{T} where Int <: T <: Int
should returnVector{Int}
so that
isleaftype(T)
guaranteesisa(T, DataType)
and pointer-egalT <: Int
describes a Union with exactly two elements:Tuple{Type{Nullable{T}}, Void} where T
should be more specific thanTuple{Type{Nullable{T}}, T} where T
.type-intersection fails to sufficiently consider that a typevar may match a non-type: issue #20869
The text was updated successfully, but these errors were encountered: