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

Restricted parametric typealiases are "unrestricted" in a parametric method #7453

Closed
mbauman opened this issue Jun 28, 2014 · 2 comments
Closed

Comments

@mbauman
Copy link
Member

mbauman commented Jun 28, 2014

Perhaps I'm doing something funny here, but this came to a surprise to me:

julia> type A{T}
         x::T
       end

julia> typealias NumericA{T<:Number} A{T}
A{T<:Number}

julia> foo{T}(::NumericA{T}) = T
foo (generic function with 1 method)

julia> methods(foo)
#1 method for generic function "foo":
foo{T}(::A{T}) at none:1

julia> foo(A("bar"))
ASCIIString (constructor with 2 methods)

I would expect foo to only be defined for A{T<:Number}, not for all T.

@JeffBezanson
Copy link
Member

See also #2552, #6721
Currently the method parameter just "wins" and overrides the typealias parameter. typealias is just very problematic and I think the existing issues capture it.

@mbauman
Copy link
Member Author

mbauman commented Jun 28, 2014

Ah, thanks. I did try to search, but all my searches included the word parametric so I missed those. Sorry for the dup.

@mbauman mbauman mentioned this issue Jul 9, 2015
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

2 participants