-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Weak type inference in a special case #13082
Comments
What is |
Thanks @yuyichao. |
So this resumes to t() = Val{123}
n() = 456
f_t() = Val{t()}
f_n() = Val{n()}
@code_warntype f_t() # ---> end::Type{Val{Val{123}}} type inferred
@code_warntype f_n() # ---> end::TYPE{_<:VAL{T}} type not inferred @yuyichao, are you sure this is the same issue of #11159? If so, which line of #3440 covers it? |
Yes. At least almost.
See Jameson's comment #11159 (comment) . |
cdsousa
added a commit
to cdsousa/Images.jl
that referenced
this issue
Sep 26, 2015
Workaround JuliaLang/julia#13082. Trying to partially fix JuliaImages#356.
johnnychen94
pushed a commit
to johnnychen94/Images.jl
that referenced
this issue
May 21, 2022
Workaround JuliaLang/julia#13082. Trying to partially fix #356.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the not so good title. I'm not sure about the right words to describe this issue.
Hence I'll put it as an auto-explainable (I hope) example. I found this issue due to JuliaImages/Images.jl#356.
Let's begin with the following definitions
In case we call
f
with a variable whose type has a Datatype as parameter,the final type is correctly inferred.
However, I we call
f
with a variable whose type has an integer value as parameter,the return type cannot be correctly inferred (
end::B{N}
).Can this be considered a bug, or is there any technical difficulty with this?
Moreover, something stranger occurs. If we wrap the integer value within a parametric type, e.g. a
Tuple
, the inference works:The text was updated successfully, but these errors were encountered: