HyperFormula.buildFromArray([['=VSTACK(SEQUENCE(B1),SEQUENCE(2))', 2]], {licenseKey: 'gpl-v3'}) throws Error: Resizing to smaller array instead of spilling 1,2,1,2. Same for =HSTACK(SEQUENCE(1,B1),SEQUENCE(1,2)), ={SEQUENCE(B1);1} and =ARRAY_CONSTRAIN(VSTACK(SEQUENCE(B1),SEQUENCE(2)),4,1). When it happens on setCellContents(B1, 2) the engine is left inconsistent (B1 holds 2, A1 still shows the values for B1 = 1).
Cause: vstackArraySize/hstackArraySize (and the ARRAY case of ArraySizePredictor) add up sub-sizes without checking isRef, so an element of unknown size counts as 1×1 and the predicted array is smaller than the evaluated one; ArrayValue.resize then throws. Wrapping the stack in a scalar function avoids it because the prediction is scalar.
Expected: when any element's size is unknown, the stack should predict ArraySize.error() (scalar fallback), as SEQUENCE itself does.
Reproduced on develop at c920375 (the merge-base of #1774; develop has had no src/ changes since). Unrelated to #1774, except that its runtime guard now returns #VALUE! when the evaluated stack also exceeds maxRows.
HyperFormula.buildFromArray([['=VSTACK(SEQUENCE(B1),SEQUENCE(2))', 2]], {licenseKey: 'gpl-v3'})throwsError: Resizing to smaller arrayinstead of spilling 1,2,1,2. Same for=HSTACK(SEQUENCE(1,B1),SEQUENCE(1,2)),={SEQUENCE(B1);1}and=ARRAY_CONSTRAIN(VSTACK(SEQUENCE(B1),SEQUENCE(2)),4,1). When it happens onsetCellContents(B1, 2)the engine is left inconsistent (B1 holds 2, A1 still shows the values for B1 = 1).Cause:
vstackArraySize/hstackArraySize(and theARRAYcase ofArraySizePredictor) add up sub-sizes without checkingisRef, so an element of unknown size counts as 1×1 and the predicted array is smaller than the evaluated one;ArrayValue.resizethen throws. Wrapping the stack in a scalar function avoids it because the prediction is scalar.Expected: when any element's size is unknown, the stack should predict
ArraySize.error()(scalar fallback), asSEQUENCEitself does.Reproduced on
developatc920375(the merge-base of #1774; develop has had nosrc/changes since). Unrelated to #1774, except that its runtime guard now returns#VALUE!when the evaluated stack also exceedsmaxRows.