Skip to content

Commit

Permalink
fix JuliaLang#11357, bug in getfield tfunc
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 21, 2015
1 parent a03ad8c commit 49d3b6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ const getfield_tfunc = function (A, s0, name)
if s <: Tuple && name === Symbol
return Bottom, true
end
if isa(A[2],QuoteNode) && isa(A[2].value,Symbol)
haveargs = A !== nothing && length(A)>1
if haveargs && isa(A[2],QuoteNode) && isa(A[2].value,Symbol)
fld = A[2].value
A1 = A[1]
if isa(A1,Module) && isdefined(A1,fld) && isconst(A1, fld)
Expand Down Expand Up @@ -307,7 +308,7 @@ const getfield_tfunc = function (A, s0, name)
end
end
return Bottom, true
elseif isa(A[2],Int)
elseif haveargs && isa(A[2],Int)
if isa(A[1],Module) || s === Module
return Bottom, true
end
Expand Down
8 changes: 8 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2816,3 +2816,11 @@ g10995((1, 2))
# issue #11149
@noinline f11149(a,b,args...) = (a,b,args...)
@test f11149(1,2,3) == invoke(f11149, Tuple{Int,Int,Int}, 1,2,3)

# issue #11357
function f11357()
x = (1,2,3)
i = (1,)
x[i...]
end
@test f11357() === 1

0 comments on commit 49d3b6b

Please sign in to comment.