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 ==, StaticBool promotion #110

Merged
merged 6 commits into from
May 10, 2023
Merged

fix ==, StaticBool promotion #110

merged 6 commits into from
May 10, 2023

Conversation

jlchan
Copy link
Contributor

@jlchan jlchan commented May 10, 2023

Fixes #108

@jlchan jlchan changed the title fix Bool promotion fix ==, StaticBool promotion May 10, 2023
@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Merging #110 (c5fc3e1) into master (f2d944f) will decrease coverage by 0.43%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
- Coverage   99.00%   98.57%   -0.43%     
==========================================
  Files           3        3              
  Lines         701      702       +1     
==========================================
- Hits          694      692       -2     
- Misses          7       10       +3     
Impacted Files Coverage Δ
src/Static.jl 98.10% <100.00%> (-0.71%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@chriselrod chriselrod left a comment

Choose a reason for hiding this comment

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

LGTM

@chriselrod
Copy link
Collaborator

I get

julia> using SnoopCompileCore

julia> invals = @snoopr using Static
145-element Vector{Any}:
  MethodInstance for last(::AbstractUnitRange)
 1
  MethodInstance for getproperty(::AbstractUnitRange, ::Symbol)
  "jl_method_table_insert"
  getproperty(x::Union{Static.OptionallyStaticUnitRange{F, L}, Static.OptionallyStaticStepRange{F, <:Any, L}} where {F, L}, s::Symbol) @ Static ~/.julia/packages/Static/WMMz0/src/ranges.jl:331
  "jl_method_table_insert"
  MethodInstance for UnitRange{Int64}(::Real, ::Real)
 1
  MethodInstance for UnitRange{Int64}(::UnitRange)
 2
  MethodInstance for Base.Broadcast.axistype(::Any, ::Base.OneTo{Int64})
 3
  MethodInstance for Base.Broadcast._bcs1(::Base.OneTo{Int64}, ::Any)
 4
  MethodInstance for Base.Broadcast._bcs(::Tuple{Base.OneTo{Int64}}, ::Tuple)
 5
  MethodInstance for Base.Broadcast.broadcast_shape(::Tuple{Base.OneTo{Int64}}, ::Tuple)
 6
  MethodInstance for Base.Broadcast.combine_axes(::Vector{Int64}, ::Array)
 7
  MethodInstance for Base.Broadcast.instantiate(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{_A}, Nothing, typeof(>=), <:Tuple{Vector{Int64}, Array}} where _A)
 8
  MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{_A}, Nothing, typeof(>=), <:Tuple{Vector{Int64}, Array}} where _A)
 
 2
  MethodInstance for all(::Base.IteratorsMD.var"#23#25", ::Tuple{Vararg{OrdinalRange{Int64, Int64}, N}} where N)
 2
  Tuple{typeof(step), OrdinalRange{Int64, Int64}}
  step(::Static.OptionallyStaticStepRange{<:Any, StaticInt{S}}) where S @ Static ~/.julia/packages/Static/WMMz0/src/ranges.jl:169
  "jl_method_table_insert"
  MethodInstance for (::Function, ::Function)
  "invalidate_mt_cache"
  MethodInstance for Base.to_index(::Vector{UInt8}, ::Number)
 1
  MethodInstance for Base._to_indices1(::Vector{UInt8}, ::Tuple{Base.OneTo{Int64}}, ::Number)
 2
  MethodInstance for to_indices(::Vector{UInt8}, ::Tuple{Base.OneTo{Int64}}, ::Tuple{Number})
 3
  MethodInstance for to_indices(::Vector{UInt8}, ::Tuple{Number})
 4
  MethodInstance for getindex(::Vector{UInt8}, ::Number)
 5
  MethodInstance for Base.to_index(::Number)
  "jl_method_table_insert"
  to_index(x::StaticInt) @ Static ~/.julia/packages/Static/WMMz0/src/Static.jl:84
  "jl_method_table_insert"

on both this branch and master.

@Tokazama
Copy link
Collaborator

Does the invalidation tree show this is due to this PR or a regression from Base

@chriselrod
Copy link
Collaborator

Does the invalidation tree show this is due to this PR or a regression from Base

It was the same on master and this PR, so it's at least unrelated to this PR.

@Tokazama
Copy link
Collaborator

I'm looking into it. The biggest culprit is

 inserting zero(T::Type{<:StaticBool}) @ Static ~/projects/Static.jl/src/Static.jl:390 invalidated:
   backedges: 1: superseding zero(::Type{T}) where T<:Number @ Base number.jl:309 with MethodInstance for zero(::Type{T} where T<:Integer) (9 children)

Which is being fickle with my initial attempts

@jlchan
Copy link
Contributor Author

jlchan commented May 10, 2023

If the invalidations are unrelated to this PR, would it be OK to merge this first?

@Tokazama Tokazama merged commit 4f20be1 into SciML:master May 10, 2023
@jlchan
Copy link
Contributor Author

jlchan commented May 10, 2023

Thanks! Would you mind releasing a new version as well? This would fix some CI issues we're currently having.

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.

Static.False()==true throws TypeError
3 participants