JuliaArrays / UnsafeArrays.jl

Stack-allocated pointer-based array views
Other
42 stars 5 forks source link

`@uviews` macro hygiene issue #18

Closed jondeuce closed 10 months ago

jondeuce commented 10 months ago

The @uviews macro fails if the UnsafeArrays module symbol is not available in the current scope. MWE:

using UnsafeArrays: @uviews
A = rand(3, 3)
@uviews A view(A, 1, :) # UndefVarError: `UnsafeArrays` not defined

The issue is that when the macro builds the expression, it refers to UnsafeArrays.uview.

I fixed it by just interpolating $UnsafeArrays.uview instead, and modified the tests to run inside a dummy module where UnsafeArrays is not defined. I also fixed a couple silently broken tests that were not being run.

oschulz commented 10 months ago

Thanks @jondeuce !

codecov[bot] commented 10 months ago

Codecov Report

Merging #18 (aaea586) into main (bfe7e49) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #18   +/-   ##
=======================================
  Coverage   99.22%   99.22%           
=======================================
  Files           4        4           
  Lines         129      129           
=======================================
  Hits          128      128           
  Misses          1        1           
Files Changed Coverage Δ
src/uview.jl 97.77% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

oschulz commented 10 months ago

https://github.com/JuliaRegistries/General/pull/89903

Thanks again, @jondeuce !

jondeuce commented 10 months ago

no problem! it's a great package 👍