Skip to content

@bb @. mat = 0 results in integer assignment, not elementwise assignmentย #23

@RomeoV

Description

@RomeoV

Describe the bug ๐Ÿž

The combination of @bb and @. doesn't work well for assignments.
In particular, this combination results in an integer assignment:

# julia 1.12
# ]add StaticArrays MaybeInplace
sarr = @SMatrix rand(6,6);
@bb @. sarr = 0
@assert sarr == 0

This causes a bug in NonlinearSolveBase.jl here when used with StaticArrays.

Expected behavior

Instead of @bb @. sarr = 0 setting sarr to the integer, it should set all values in the matrix to zero elementwise.

Minimal Reproducible Example ๐Ÿ‘‡

See above.

Error & Stacktrace โš ๏ธ

N/A

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
(jl_HoHNA6) pkg> st
Status `/tmp/jl_HoHNA6/Project.toml`
  [bb5d69b7] MaybeInplace v0.1.4
  [90137ffa] StaticArrays v1.9.16
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
julia> using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `/tmp/jl_HoHNA6/Manifest.toml`
  [79e6a3ab] Adapt v4.4.0
  [4fba245c] ArrayInterface v7.22.0
  [1914dd2f] MacroTools v0.5.16
  [bb5d69b7] MaybeInplace v0.1.4
  [aea7be01] PrecompileTools v1.3.3
  [21216c6a] Preferences v1.5.1
  [ae029012] Requires v1.3.1
  [90137ffa] StaticArrays v1.9.16
  [1e83bf80] StaticArraysCore v1.4.4
  [56f22d72] Artifacts v1.11.0
  [ade2ca70] Dates v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.12.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [4536629a] OpenBLAS_jll v0.3.29+0
  [8e850b90] libblastrampoline_jll v5.15.0+0

  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.12.5
Commit 5fe89b8ddc1 (2026-02-09 16:05 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 ร— 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, tigerlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions