You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refuse reassignment between scalar and array shapes
check_assignment_compatible() exempted any assignment where either side
was length 1, so the two shape changes R handles by rebinding the symbol
went undiagnosed in both directions:
x <- numeric(n); x <- 0 broadcast 0 across every element (R: length 1)
x <- 1; x <- numeric(3) kept only the first element (R: length 3)
Only the both-sides-length-1 case is genuinely compatible (a declared
double(1) is rank 1, a literal is rank 0), so exempt that and let
everything else reach the shape checks. Deferred-shape locals still
reallocate for an array value, as before.
Three declare()-size-expression tests assigned a scalar into an array
target as a way of reaching the size validator; they now use the same
size expression on both sides, which reaches the intended error without
depending on the exemption.
0 commit comments