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

constants defeat type inference of parametric types #9775

Closed
stevengj opened this issue Jan 14, 2015 · 2 comments
Closed

constants defeat type inference of parametric types #9775

stevengj opened this issue Jan 14, 2015 · 2 comments

Comments

@stevengj
Copy link
Member

This was unexpected:

using Base.Test
const FOO=1
type Foo{K}; end
foo() = Foo{FOO}()
@inferred foo()

gives

ERROR: return type Foo{1} does not match inferred return type Foo{K}
 in error at error.jl:19

Is it reasonable to expect Julia to be able to recognize constants in type parameters here?

cc: @simonster

@stevengj stevengj mentioned this issue Jan 14, 2015
5 tasks
@simonster
Copy link
Member

Maybe a dup of #5560? Although in this case, we don't even need to run type inference before performing the substitution.

@stevengj
Copy link
Member Author

Yah, mostly a dup.

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