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

Return type not inferred with invoke and keyword arguments #29216

Closed
nalimilan opened this issue Sep 16, 2018 · 1 comment
Closed

Return type not inferred with invoke and keyword arguments #29216

nalimilan opened this issue Sep 16, 2018 · 1 comment
Labels
compiler:inference Type inference

Comments

@nalimilan
Copy link
Member

The example is silly, but this pattern is useful to fix ambiguities when there are multiple argument.

f(x::Integer; arg=1) = 1
f(x::Int; arg=1) = invoke(f, Tuple{Integer}, x, arg=arg)

julia> @code_warntype f(1)
Body::Any
1 1%1 = %new(NamedTuple{(:arg,),Tuple{Int64}}, 1)::NamedTuple{(:arg,),Tuple{Int64}}                                │╻╷╷╷ #f#16%2 = (getfield(Core, Symbol("#kw##invoke"))())(%1, Main.invoke, Main.f, Tuple{Integer}, x)::Any                 ││
  └──      return %2
@adienes
Copy link
Contributor

adienes commented Sep 8, 2023

this does not reproduce on master (1.11.0-DEV.413)

@vtjnash vtjnash closed this as completed Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference
Projects
None yet
Development

No branches or pull requests

3 participants