Skip to content

Commit

Permalink
Fix #12476
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Aug 9, 2015
1 parent 783f870 commit b3dd473
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ end
function abstract_call_gf(f, fargs, argtype, e)
argtypes = argtype.parameters
tm = _topmod()
if length(argtypes)>1 && (argtypes[1] <: Tuple) && argtypes[2]===Int
if length(argtypes)>1 && argtypes[2]===Int && (argtypes[1] <: Tuple ||
(isa(argtypes[1], DataType) && isdefined(Main, :Base) && isdefined(Main.Base, :Pair) &&
(argtypes[1]::DataType).name === Main.Base.Pair.name))
# allow tuple indexing functions to take advantage of constant
# index arguments.
if istopfunction(tm, f, :getindex)
Expand Down
7 changes: 7 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3193,3 +3193,10 @@ let x = (1,2)
@eval f12517() = Val{$x}
@test f12517() === Val{(1,2)}
end

# issue #12476
function f12476(a)
(k, v) = a
v
end
@inferred f12476(1.0 => 1)

0 comments on commit b3dd473

Please sign in to comment.