Summary
The VaR, CTE, and WangTransform constructors use @assert for input validation:
function VaR(α::T) where {T}
@assert 0 <= α < 1 "α of $α is not 0 ≤ α < 1"
return new{T}(α)
end
@assert can be optimized away by the compiler (e.g. with --check-bounds=no), making it unreliable for public API validation. These should use throw(DomainError(...)) or throw(ArgumentError(...)).
The test file (test/risk_measures.jl) currently tests for AssertionError specifically, which would need updating.
Fix
- Replace
@assert with explicit throw in VaR, CTE, WangTransform constructors
- Update tests from
@test_throws AssertionError to the new exception type
🤖 Generated with Claude Code
Summary
The
VaR,CTE, andWangTransformconstructors use@assertfor input validation:@assertcan be optimized away by the compiler (e.g. with--check-bounds=no), making it unreliable for public API validation. These should usethrow(DomainError(...))orthrow(ArgumentError(...)).The test file (
test/risk_measures.jl) currently tests forAssertionErrorspecifically, which would need updating.Fix
@assertwith explicitthrowinVaR,CTE,WangTransformconstructors@test_throws AssertionErrorto the new exception type🤖 Generated with Claude Code