Skip to content

Commit 91effb8

Browse files
RomeoVmateuszbaran
andauthored
Make DimensionMismatch error string lazy (#34)
* Make `DimensionMismatch` error string lazy This appeases `JET.jl` and makes this path testable for trimming with JuliaC.jl. * Bump version * Fixup lazy string for older Julia versions This is fine since trimmability is anyways only a concern for later versions of Julia. * Update src/StaticArraysCore.jl --------- Co-authored-by: Mateusz Baran <[email protected]>
1 parent c2971e5 commit 91effb8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StaticArraysCore"
22
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3-
version = "1.4.3"
3+
version = "1.4.4"
44

55
[compat]
66
julia = "1.6"

src/StaticArraysCore.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ struct SizedArray{S<:Tuple,T,N,M,TData<:AbstractArray{T,M}} <: StaticArray{S,T,N
264264
function SizedArray{S,T,N,M,TData}(a::TData) where {S<:Tuple,T,N,M,TData<:AbstractArray{T,M}}
265265
Base.require_one_based_indexing(a)
266266
if size(a) != size_to_tuple(S) && size(a) != (tuple_prod(S),)
267-
throw(DimensionMismatch("Dimensions $(size(a)) don't match static size $S"))
267+
@static if VERSION >= v"1.8"
268+
throw(DimensionMismatch(lazy"Dimensions $(size(a)) don't match static size $S"))
269+
else
270+
throw(DimensionMismatch("Dimensions $(size(a)) don't match static size $S"))
271+
end
268272
end
269273
return new{S,T,N,M,TData}(a)
270274
end

0 commit comments

Comments
 (0)