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 whereparams that are unions #11

Merged
merged 1 commit into from
Sep 7, 2020
Merged

fix whereparams that are unions #11

merged 1 commit into from
Sep 7, 2020

Conversation

oxinabox
Copy link
Member

@oxinabox oxinabox commented Sep 7, 2020

I think I need this for
invenia/Nabla.jl#189

Before it would get this wrong:

julia> foo(x::T) where T<:Union{Float32,Bool} = 2x
foo (generic function with 1 method)


julia> signature(@which foo(true))
Dict{Symbol,Any} with 3 entries:
  :name        => :foo
  :args        => Expr[:(x::T)]
  :whereparams => Any[:(T <: var"Union{Bool, Float32}")]

julia> splitdef(:(foo(x::T) where T<:Union{Float32,Bool} = 2x))
Dict{Symbol,Any} with 5 entries:
  :args        => Any[:(x::T)]
  :body        => quote
  :name        => :foo
  :head        => :(=)
  :whereparams => Any[:(T <: Union{Float32, Bool})]

This fixes it so that signature matches splitdef

@codecov
Copy link

codecov bot commented Sep 7, 2020

Codecov Report

Merging #11 into master will increase coverage by 0.70%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
+ Coverage   98.60%   99.31%   +0.70%     
==========================================
  Files           4        4              
  Lines         143      145       +2     
==========================================
+ Hits          141      144       +3     
+ Misses          2        1       -1     
Impacted Files Coverage Δ
src/method.jl 100.00% <100.00%> (+1.69%) ⬆️
src/function.jl 98.73% <0.00%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b643de...1461ecd. Read the comment docs.

@oxinabox oxinabox merged commit 4b175b0 into master Sep 7, 2020
@oxinabox oxinabox deleted the ox/sigwhere branch September 7, 2020 16:09
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.

2 participants