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

Proposal for interaction of diagonal rule and lower bounds #26453

Closed
julbinb opened this issue Mar 14, 2018 · 1 comment
Closed

Proposal for interaction of diagonal rule and lower bounds #26453

julbinb opened this issue Mar 14, 2018 · 1 comment
Assignees
Labels
domain:types and dispatch Types, subtyping and method dispatch

Comments

@julbinb
Copy link

julbinb commented Mar 14, 2018

If I understand correctly, right now the rule for Tuple{T,T} where T>:t is: T is considered diagonal unless it is obvious that t is abstract. Therefore, in the examples below the types on the right are not diagonal:

julia> (Tuple{A,A} where A>:Integer) <: Tuple{T,T} where T>:Number
true

julia> (Tuple{A,A,Number} where A>:Number) <: Tuple{T,T,S} where T>:S where S>:Integer
true

In the following modification of the previous example, however, T is considered diagonal despite the fact that its lower bound S can be abstract.

julia> (Tuple{A,A,Number} where A>:Number) <: Tuple{T,T,S} where T>:S where S
false

I totally see that it is a hard task to determine concreteness of types involving variables. What I would suggest is to change the strategy for Tuple{T,T} where T>:t and consider T non-diagonal unless it is obvious that t is concrete. I think that if programmers write lower bounds, it is likely that they really want to switch off the diagonal rule.

@JeffBezanson JeffBezanson added the domain:types and dispatch Types, subtyping and method dispatch label Mar 14, 2018
@JeffBezanson
Copy link
Sponsor Member

Seems like a good idea to me.

@JeffBezanson JeffBezanson self-assigned this Mar 21, 2018
mbauman added a commit that referenced this issue Apr 12, 2018
* origin/master:
  A few more #26670 fixes (#26773)
  Revert "deprecate using the value of `.=`. fixes #25954" (#26754)
  change dim arguments for `diff` and `unique` to keyword args (#26776)
  reorder pmap arguments to allow do-block syntax (#26783)
  correct deprecated parametric method syntax (#26789)
  [NewOptimizer] handle new IR nodes correctly in binary format
  [NewOptimizer] support line number emission from new IR format
  fix #26453, require obviously-concrete lower bound for a var to be diagonal (#26567)
  fix #26743, spurious `return` path in try-finally in tail position (#26753)
  Also lift SelectInst addrspaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

2 participants