Commit d79d0b3
Fix type inference issue in LinearCache initialization with LinearVerbosity
This commit resolves a type stability issue in the `init` function where
the compiler could not infer a concrete type for the `LinearVerbosity`
parameter in `LinearCache`, causing `@inferred` tests to fail.
Changes:
- Added `Base.@constprop :aggressive` to `__init` function to enable
aggressive constant propagation for better type inference
- Refactored verbose parameter processing into type-stable helper methods
`_process_verbose` that use method dispatch
- Made `LinearVerbosity(Standard())` constructor explicit with concrete
argument types instead of calling `LinearVerbosity()`
- Added `@inline` annotation to preset constructor for better optimization
The fix ensures that when `verbose=true` (the default), the compiler can
determine the concrete `LinearVerbosity` type at compile time, eliminating
the type instability that caused the test failure.
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 6a49ebe commit d79d0b3
2 files changed
+44
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
235 | 257 | | |
236 | 258 | | |
237 | 259 | | |
| |||
261 | 283 | | |
262 | 284 | | |
263 | 285 | | |
264 | | - | |
| 286 | + | |
265 | 287 | | |
266 | 288 | | |
267 | 289 | | |
| |||
324 | 346 | | |
325 | 347 | | |
326 | 348 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
343 | 352 | | |
344 | 353 | | |
345 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
186 | 202 | | |
187 | 203 | | |
188 | 204 | | |
| |||
0 commit comments