Skip to content
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

_type_lb and _type_ub are wrong #21

Closed
cjdoris opened this issue Apr 26, 2021 · 1 comment
Closed

_type_lb and _type_ub are wrong #21

cjdoris opened this issue Apr 26, 2021 · 1 comment

Comments

@cjdoris
Copy link
Collaborator

cjdoris commented Apr 26, 2021

e.g. _type_ub(Vector{Vector{T}} where {T<:Int}) == Vector{Vector{Int}}, when the intention is that it is Vector{Vector{T} where {T<:Int}}

@cjdoris
Copy link
Collaborator Author

cjdoris commented Apr 28, 2021

Actually the above comment is incorrect, because Vector{Vector{T} where {T<:Int}} is not a subtype of Vector{Vector{T}}.

I'm keeping _type_ub as it is, replacing each typevar with its upper bound. This gives the most general specialisation of the type.

_type_lb is similar, but any typevars which are a parameter of the outermost type are replaces with their lower bound.

e.g. _type_lb(Vector{Vector{T}} where {T<:Int}) == Vector{Vector{Int}} == _type_ub(...) because T is not a parameter of the top type.

e.g. _type_lb(Vector{<:Vector{<:Int}}) == Vector{Union{}} and _type_ub(Vector{<:Vector{<:Int}}) == Vector{Vector{<:Int}}

@cjdoris cjdoris closed this as completed Apr 28, 2021
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

1 participant