From 98300525921ebc7a4dbce192ba4a47bc686dd0fc Mon Sep 17 00:00:00 2001 From: Em Chu Date: Wed, 26 Mar 2025 13:55:20 -0700 Subject: [PATCH 1/2] Allow for proposed new parsing of array[end] in Setfield --- src/sugar.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sugar.jl b/src/sugar.jl index 07bdd50..d2a39ad 100644 --- a/src/sugar.jl +++ b/src/sugar.jl @@ -65,20 +65,21 @@ const HAS_BEGIN_INDEXING = VERSION ≥ v"1.5.0-DEV.666" function need_dynamic_lens(ex) return foldtree(false, ex) do yes, x - (yes || x === :end || (HAS_BEGIN_INDEXING && x === :begin) || x === :_) + (yes || x === :end || (HAS_BEGIN_INDEXING && x === :begin) || + x == Expr(:end) || (HAS_BEGIN_INDEXING && x == Expr(:begin)) || x === :_) end end function lower_index(collection::Symbol, index, dim) if isexpr(index, :call) return Expr(:call, lower_index.(collection, index.args, dim)...) - elseif (index === :end) + elseif (index === :end || index == Expr(:end)) if dim === nothing return :($(Base.lastindex)($collection)) else return :($(Base.lastindex)($collection, $dim)) end - elseif HAS_BEGIN_INDEXING && (index === :begin) + elseif HAS_BEGIN_INDEXING && (index === :begin || index == Expr(:begin)) if dim === nothing return :($(Base.firstindex)($collection)) else From 57ad277c528114be2e82bdb3fc4de3fad5d30156 Mon Sep 17 00:00:00 2001 From: Em Chu Date: Wed, 26 Mar 2025 13:56:36 -0700 Subject: [PATCH 2/2] Bump version to 0.8.3 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index f622669..6dd38fd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Setfield" uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" -version = "0.8.2" +version = "0.8.3" [deps] ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"