-
Notifications
You must be signed in to change notification settings - Fork 41
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
Check Type has parameters field with an element #493
Conversation
Fixes type Union has no field parameters JuliaDebug#494
Unfortunately it seems that |
Codecov Report
@@ Coverage Diff @@
## master #493 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 9 9
Lines 1511 1511
======================================
Misses 1511 1511 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it will be measurable (and so we can merge this), but presumably extract_inner_type
will be specialized for every type. The old code tried to avoid that but it may not be readily fixable. So I'm fine with merging this, thanks for tackling it!
EDIT: Oh, just saw you commented on the same issue.
function type_annotation_mode(node, @nospecialize(T); type_annotations::Bool, hide_type_stable::Bool) | ||
kind(node) == K"return" && return false, "", "", "" | ||
type_annotate = is_show_annotation(T; type_annotations, hide_type_stable) | ||
pre = pre2 = post = "" | ||
if type_annotate | ||
if T isa Type && T <: Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess this should have been T <: Type{S} where S
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Union{} <: Type{S} where S
is true so I don't think that would have fixed it either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be T isa DataType
or Base.isType(T)
julia> TT = Type{Float64}
Type{Float64}
julia> TT.parameters[1]
Float64 Basically we were extracting the |
I thought |
I believe it should be enough to just change the check to |
|
Given we don't think the current implementation will be particularly slow I'll merge it for now, and we can revisit this if it is slow. |
Fixes JuliaDebug#506 which was due to calling `extract_inner_type` with `Type{AbstractArray{var"#s91"<:Real, 1}}`. Uses suggestions from JuliaDebug#493, this also removes the specialisation compared to the current implementation.
Fixes #491, #492, #494