Resolve survival/decrement method ambiguities (breaking: narrower first-argument types) - #138
Open
alecloudenback wants to merge 1 commit into
Open
alecloudenback wants to merge 1 commit into
alecloudenback wants to merge 1 commit into
Conversation
The rate-vector methods of survival now require an AbstractArray first argument, decrement is a single vararg wrapper over survival, and the integer-age DeathDistribution method delegates to the plain one. Parametric models accept and ignore a DeathDistribution, and omega of a parametric model is Inf, so they work wherever LifeContingencies passes a fractional-age assumption. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor/02-deps #138 +/- ##
===================================================
Coverage ? 90.02%
===================================================
Files ? 8
Lines ? 381
Branches ? 0
===================================================
Hits ? 343
Misses ? 38
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
masterhas 5 ambiguous method pairs (2 onsurvival, 3 ondecrement). Two of them defeat guard rails that exist on purpose:survival(Makeham(), 65, Uniform())andsurvival(table, 10, Uniform())raise an ambiguityMethodErrorinstead of working or raising the intendedArgumentError.Changes
survivalmethods takev::AbstractArrayinstead of an untyped first argument.DeathDistributionand ignored it now delegates to the plain integer method.from_age == to_agespecial case is gone; reducing over an empty view already returnsinit, which is also what gives the documented "reversed ages return 1.0" behavior.decrementis one method,decrement(v, args...) = 1 - survival(v, args...). Table misuse routes through thesurvivalArgumentError.DeathDistribution(LifeContingencies'SingleLifepasses one and currently gets aMethodError), andomega(::ParametricMortality) == Inf.Testing
Test.detect_ambiguitiesis now asserted empty in the suite (0, down from 5).length(methods(decrement)) == 1.ArgumentErroron tables with aDeathDistribution, and for the parametric pass-throughs andomega.Stacked on #137 (base branch
refactor/02-deps). Merge the stack in order; once the base PR is merged and its branch deleted, GitHub retargets this PR tomaster.🤖 Generated with Claude Code
https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT