Skip to content

Fix deprecation warnings#159

Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:fix/deprecation-warnings
Feb 9, 2026
Merged

Fix deprecation warnings#159
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:fix/deprecation-warnings

Conversation

@ChrisRackauckas-Claude
Copy link
Contributor

Summary

  • Properly deprecate dualcache using Base.depwarn instead of a silent const alias. Now dualcache(...) emits a deprecation warning directing users to use DiffCache instead.
  • Eliminate method overwrite warnings in tests by giving unique names to redefined functions (foofoo_lbc/foo_larray in core_odes.jl, objfunobjfun2 in core_nesteddual.jl).

Details

dualcache deprecation

The previous code had:

# Legacy deprecate later
const dualcache = DiffCache

This allowed dualcache(...) to work silently with no deprecation notice, even with --depwarn=error. The fix replaces this with a proper deprecation function:

function dualcache(args...; kwargs...)
    Base.depwarn("`dualcache` is deprecated, use `DiffCache` instead.", :dualcache)
    return DiffCache(args...; kwargs...)
end

Method overwrite warnings

Tests defined the same function name (foo, objfun) multiple times in the same @safetestset module, causing WARNING: Method definition ... overwritten messages. While not deprecation errors, these warnings are noise that can mask real issues. Fixed by using unique function names.

Upstream deprecation status

Ran full test suite with --depwarn=error on Julia 1.12.4. No deprecation warnings from upstream dependencies (ArrayInterface, Adapt, SciMLBase, ForwardDiff, OrdinaryDiffEq, Optimization, etc.) were triggered. All current API usages are non-deprecated.

Test plan

  • All 12 test suites pass with --depwarn=error
  • No method overwrite warnings
  • dualcache properly emits deprecation warning with --depwarn=yes
  • dualcache properly throws error with --depwarn=error
  • Aqua.jl quality checks pass (including test_undefined_exports)
  • Runic formatting verified

🤖 Generated with Claude Code

- Properly deprecate `dualcache` with `Base.depwarn` instead of plain
  const alias. The old `const dualcache = DiffCache` silently allowed
  usage without any deprecation notice. Now using `dualcache(...)` emits
  a deprecation warning directing users to `DiffCache`.

- Rename redefined test functions to eliminate method overwrite warnings:
  - `foo` → `foo_lbc` and `foo_larray` in test/core_odes.jl
  - `objfun` → `objfun2` (with corresponding `fn2`) in
    test/core_nesteddual.jl

All tests pass with `--depwarn=error` on Julia 1.12.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 8aa8a91 into SciML:master Feb 9, 2026
14 of 16 checks passed
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.

3 participants