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

Assignment T{TT} = Int should error #25642

Open
mauro3 opened this issue Jan 19, 2018 · 5 comments
Open

Assignment T{TT} = Int should error #25642

mauro3 opened this issue Jan 19, 2018 · 5 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@mauro3
Copy link
Contributor

mauro3 commented Jan 19, 2018

I think this should throw an error (or does it make sense?):

julia> T{TT} = Int                                                                                                                                                       
Int64                                                                                                                                                                    

instead it semi-works:

julia> T                                                                                                                                                                 
Int64                                                                                                                                                                    

thus the parameter TT is, I think, just silently ignored.

Here what it gets lowered to:

julia> Meta.lower(Main, :(T{TT} = Int))
:($(Expr(:thunk, CodeInfo(:(begin
      const T
      TT = (Core.TypeVar)(:TT)
      SSAValue(0) = (Core.UnionAll)(TT, Int)
      T = SSAValue(0)
      return SSAValue(0)
  end)))))
@brenhinkeller brenhinkeller added the types and dispatch Types, subtyping and method dispatch label Nov 21, 2022
@brenhinkeller
Copy link
Contributor

Does still reproduce, but no idea if this is a problem or not

@StefanKarpinski
Copy link
Member

@JeffBezanson, any opinion on this? Bug or feature?

@vtjnash
Copy link
Member

vtjnash commented Nov 21, 2022

Probably breaking now, though might be interesting in the future to require that (some or all) where clauses will error if they do not produce a UnionAll result

@StefanKarpinski
Copy link
Member

Are there any legitimately useful applications of this? If not, then we could consider it a minor change and PkgEval disallowing it.

@adienes
Copy link
Member

adienes commented Jan 25, 2025

if it's not possible to remove this (although I'm not sure what it's supposed to mean and imo looks like it should be an error), maybe a candidate for #54903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

5 participants