Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

Fixes #1105 - Default ODEInputFunction constructor fails because __has_controljac is not defined.

Problem

The ODEInputFunction constructor was failing with UndefVarError: __has_controljac not defined when using the default value for the controljac keyword argument. The constructor tries to call __has_controljac(f) but this function was never defined.

Root Cause

The __has_controljac function is referenced in the ODEInputFunction constructor at lines 2123 and 4776 of src/scimlfunctions.jl, but the function definition was missing from the list of utility functions.

Solution

Added the missing function definition:

__has_controljac(f) = hasfield(typeof(f), :controljac)

This follows the exact same pattern as other __has_* utility functions in the codebase (like __has_paramjac, __has_jac_prototype, __has_controljac_prototype, etc.).

Testing

✅ Verified the fix works with the original MRE:

  • ODEInputFunction((x, u, p, t) -> x; controljac = nothing) - works ✓
  • ODEInputFunction((x, u, p, t) -> x) - now works ✓ (was failing before)

The fix is minimal, follows existing patterns, and resolves the issue without affecting any other functionality.

Closes #1105

🤖 Generated with Claude Code

Fixes issue SciML#1105 where ODEInputFunction constructor fails with default
controljac parameter because __has_controljac function was not defined.

Added __has_controljac(f) = hasfield(typeof(f), :controljac) alongside
other similar utility functions in scimlfunctions.jl.

This follows the same pattern as other __has_* functions in the codebase
and allows ODEInputFunction to properly check for controljac field presence.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit 1eb35ad into SciML:master Sep 3, 2025
45 of 63 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.

Default ODEInputFunction constructor fails because __has_controljac is not defined

2 participants