Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
sunxd3
reviewed
Apr 9, 2026
Collaborator
sunxd3
left a comment
There was a problem hiding this comment.
thanks for initiating this!
| if R isa Union | ||
| _validate_rdata_union(R.a) | ||
| _validate_rdata_union(R.b) | ||
| elseif R != NoRData && fdata_type(tangent_type(NoFData, R)) != NoFData |
Collaborator
There was a problem hiding this comment.
I fear the tangent_type here can produce similar error as line 931, should we catch it?
| end | ||
| make_P_lohi_union() = LoHi(1.0, 2.0)::Union{Nothing,LoHi} | ||
| make_P_lohi_container() = LoHiContainer(LoHi(1.0, 2.0)) | ||
| make_P_nothing_or_vector() = [1.0, 2.0]::Union{Nothing,Vector{Float64}} |
Collaborator
There was a problem hiding this comment.
it seems that Julia will still specialize the type instead of taking the Union type as hinted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tangent_type(NoFData, R)previously only handledR <: Union{NoRData, IEEEFloat}, causing a missing-method error whenRcontained anRData{...}branch. This extends the dispatch to coverRDataand adds_validate_rdata_unionto catch invalid branches early.Split from #1132 to make it easy to review.
Closes #1130.
CI Summary — GitHub Actions
Documentation Preview
Mooncake.jl documentation for PR #1133 is available at:
https://chalk-lab.github.io/Mooncake.jl/previews/PR1133/
Performance
Performance Ratio:
Ratio of time to compute gradient and time to compute function.
Warning: results are very approximate! See here for more context.