File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 4242static_fieldnames (:: Type{<:SymbolicDimensions} ) = ALL_SYMBOLS
4343function Base. getproperty (d:: SymbolicDimensions{R} , s:: Symbol ) where {R}
4444 nzdims = getfield (d, :nzdims )
45- i = ALL_MAPPING[s]
45+ i = get (ALL_MAPPING, s, INDEX_TYPE (0 ))
46+ iszero (i) && error (" $s is not available as a symbol in SymbolicDimensions. Symbols available: $(ALL_SYMBOLS) ." )
4647 ii = searchsortedfirst (nzdims, i)
4748 if ii <= length (nzdims) && nzdims[ii] == i
4849 return getfield (d, :nzvals )[ii]
Original file line number Diff line number Diff line change 580580
581581 # Test conversion
582582 @test typeof (SymbolicDimensions {Rational{Int}} (dimension (us " km/s" ))) == SymbolicDimensions{Rational{Int}}
583+
584+ # Helpful error if symbol not found:
585+ sym5 = dimension (us " km/s" )
586+ VERSION >= v " 1.8" &&
587+ @test_throws " rad is not available as a symbol" sym5. rad
583588end
584589
585590@testset " Test ambiguities" begin
You can’t perform that action at this time.
0 commit comments