Commit 0621b14
Fix type inference issue with LinearVerbosity keyword constructor
This commit fixes a type stability issue in the `LinearVerbosity` keyword
argument constructor that was causing type inference failures in `LinearCache`
initialization.
Root Cause:
The keyword argument constructor for `LinearVerbosity` was not type-stable
because `values(final_args)...` produces different types depending on runtime
kwargs, preventing the compiler from inferring a concrete type.
Solution:
1. Added a fast path in the keyword constructor that returns early with a
concrete type when all arguments are `nothing` (the default case)
2. Added `Base.@constprop :aggressive` to `__init` to help the compiler
propagate the default `verbose=true` constant through the call chain
This ensures that `LinearVerbosity()` with no arguments is type-stable,
which is the common case when users rely on defaults.
Changes:
- src/verbosity.jl: Added fast path for default construction
- src/common.jl: Added @constprop :aggressive to __init function
Fixes the CI error:
```
return type LinearCache{..., LinearVerbosity{...}, ...} does not match
inferred return type LinearCache{..., _A<:LinearVerbosity, ...}
```
All tests pass with this change.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 547bf0c commit 0621b14
2 files changed
+24
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
97 | 119 | | |
98 | 120 | | |
99 | 121 | | |
| |||
0 commit comments