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

fix return_type_tfunc in the case where no methods match #21066

Merged
merged 1 commit into from Mar 17, 2017

Conversation

JeffBezanson
Copy link
Sponsor Member

I discovered this while working on #20033. Example:

julia> Base.Broadcast._broadcast_eltype(g.f, g.iter)
Union{}

julia> @code_typed Base.Broadcast._broadcast_eltype(g.f, g.iter)
CodeInfo(:(begin 
        return $(QuoteNode(Any))
    end))=>Type{Any}

Changing map to match broadcast will require this bugfix, but will be a separate change.

also fix `return_type` on Builtins; this was another disparity with
  `return_type_tfunc`
@martinholters
Copy link
Member

Would we still need the "no methods match" part of this if we chose to merge #20866? (Just curiosity; I'm not implying we should prefer #20866 over this one.)

_methods_by_ftype(astype, 0, sv.params.world,
UInt[typemin(UInt)], UInt[typemax(UInt)]) !== false
# return_type returns Bottom if no methods match, even though
# inference doesn't necessarily.
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't necessarily... what, do the same?

Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't all that clear and seems incomplete ending in an adverb

@JeffBezanson
Copy link
Sponsor Member Author

#20866 would definitely simplify this, it just seems riskier. It would also be better for return_type to call abstract_call, so there is less opportunity for it to diverge from other inference code.

@JeffBezanson JeffBezanson merged commit 762b943 into master Mar 17, 2017
@StefanKarpinski StefanKarpinski deleted the jb/returntypetfunc branch March 17, 2017 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants