Skip to content

Commit

Permalink
fix #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

3 comments on commit 49d3b6b

@ihnorton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeffBezanson if you ever feel like screencasting an inference debugging session and putting it on Twitch, I would pay lunch money to watch (possibly even moderately-priced Bourbon). Obscenity-laden narration would be great too, but is not imperative.

@timholy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd up that offer. Especially if you explain your reasoning about how you find the appropriate place to start making changes.

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you seen how popular Jonathan Blow's videos of him just coding are? A handful of little narrated Jeff bugfixes might give him a run for his money.

Please sign in to comment.