Skip to content

fix: replace ArrayStyle with PeriodicArrayStyle for correct broadcast dispatch#7

Merged
AFeuerpfeil merged 2 commits intomainfrom
fix/broadcast-style
Mar 31, 2026
Merged

fix: replace ArrayStyle with PeriodicArrayStyle for correct broadcast dispatch#7
AFeuerpfeil merged 2 commits intomainfrom
fix/broadcast-style

Conversation

@AFeuerpfeil
Copy link
Copy Markdown
Member

Summary

  • Replaces Broadcast.ArrayStyle{PeriodicArray{T,N,A,F}} with a new PeriodicArrayStyle{N} <: AbstractArrayStyle{N} carrying dimensionality with proper style promotion rules.
  • Adds _find_pa helper to recover the PeriodicArray (and its .map) from anywhere in a broadcast argument tree, fixing the fragile bc.args[1].map assumption.
  • Fixes scalar-first broadcasts (1 .+ pa), mixed-element-type PA operations, and PA-with-plain-array broadcasts that previously errored or silently returned a plain Array.
  • Bumps version to 1.1.1 (bug fix).

… dispatch

The old `ArrayStyle{PeriodicArray{T,N,A,F}}` approach broke on scalar-first
broadcasts and mixed-type PA operations because `bc.args[1].map` assumed a
specific arg layout and `ArrayStyle` erased the array type info needed for
style promotion. Introducing `PeriodicArrayStyle{N} <: AbstractArrayStyle{N}`
with explicit promotion rules and a helper `_find_pa` to recover the map
from any broadcast tree fixes these cases. Bump version to 1.1.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Your PR no longer requires formatting changes. Thank you for your contribution!

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/PeriodicArrays.jl 77.77% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AFeuerpfeil AFeuerpfeil merged commit e5f110f into main Mar 31, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant