Skip to content

Commit

Permalink
Merge pull request #27 from JuliaObjects/fix26
Browse files Browse the repository at this point in the history
fix #26 warning because of wrong import of StaticArrays
  • Loading branch information
jw3126 authored Jul 29, 2021
2 parents 472b38e + 47013d8 commit 0747495
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name = "Accessors"
uuid = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
authors = ["Takafumi Arakaki <[email protected]>", "Jan Weidner <[email protected]> and contributors"]
version = "0.1.3"
version = "0.1.4"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
CompositionsBase = "a33af91c-f02d-484b-be07-31d278c5ca2b"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Future = "9fa8497b-333b-5362-9e8d-4d0656e87820"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
4 changes: 4 additions & 0 deletions src/functionlenses.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using LinearAlgebra: norm, normalize
set(obj, ::typeof(last), val) = @set obj[lastindex(obj)] = val
set(obj, ::typeof(first), val) = @set obj[firstindex(obj)] = val
set(obj, ::typeof(identity), val) = val
Expand Down Expand Up @@ -34,3 +35,6 @@ set(path, ::typeof(basename), new_name) = @set splitdir(path)[2] = new_na
set(x::Real, ::typeof(real), y) = y
set(x, ::typeof(real), y) = y + im*imag(x)
set(x, ::typeof(imag), y) = real(x) + im*y

set(arr, ::typeof(normalize), val) = norm(arr) * val
set(arr, ::typeof(norm), val) = val/norm(arr) * arr # should we check val is positive?
7 changes: 2 additions & 5 deletions src/staticarrays.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
import StaticArrays; const SA = StaticArrays
setindex(a::SA.StaticArray, args...) = Base.setindex(a, args...)

set(arr, ::typeof(SA.normalize), val) = SA.norm(arr) * val
set(arr, ::typeof(SA.norm), val) = val/SA.norm(arr) * arr # shoud we check val is positive?
import .StaticArrays
Accessors.setindex(a::StaticArrays.StaticArray, args...) = Base.setindex(a, args...)

2 comments on commit 0747495

@jw3126
Copy link
Member Author

@jw3126 jw3126 commented on 0747495 Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/41772

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.4 -m "<description of version>" 07474955ed4b12221e8bb850acd6ac2be5e69cbe
git push origin v0.1.4

Please sign in to comment.