Skip to content

Commit e2413b1

Browse files
committed
COMMON: Fix redim regression
1 parent 82467d8 commit e2413b1

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2023-06-18 (12.27)
2+
COMMON: Fix redim regression
3+
PLUGINS: Added mechanism for cleaning up resources when the associated map falls out of scope
4+
15
2023-05-12 (12.27)
26
CONSOLE: Fix image save
37
ANDROID: Fix download error when there are duplicate scratch.bas files

samples/distro-examples/tests/array.bas

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,15 @@ p(asc("|")) = 1
426426
p(asc("}")) = 1
427427
p(asc("~")) = 1
428428

429+
'
430+
' https://www.syntaxbomb.com/smallbasic/redim-why-to-keep-old-versons/
431+
'
432+
a = [0,1,2,3,4,5,6,7,8,9,10,11]
433+
redim a(11) : if a != [0,1,2,3,4,5,6,7,8,9,10,11] then throw str(a)
434+
redim a(1, 11) : if a != [0,1,2,3,4,5,6,7,8,9,10,11;0,0,0,0,0,0,0,0,0,0,0,0] then throw str(a)
435+
redim a(2, 10) : if a != [0,1,2,3,4,5,6,7,8,9,10;11,0,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,0,0,0,0,0] then throw str(a)
436+
redim a(1, 11) : if a != [0,1,2,3,4,5,6,7,8,9,10,11;0,0,0,0,0,0,0,0,0,0,0,0] then throw str(a)
437+
redim a(10) : if a != [0,1,2,3,4,5,6,7,8,9,10] then throw str(a)
438+
redim a(0 to 7): if a != [0,1,2,3,4,5,6,7] then throw str(a)
439+
redim a(0 to 1): if a != [0,1] then throw str(a)
429440

src/common/blib.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ void cmd_dim(int preserve) {
210210
}
211211
if (!preserve || var_p->type != V_ARRAY) {
212212
v_new_array(var_p, size);
213-
} else if (v_maxdim(var_p) != dimensions) {
214-
err_matdim();
215213
} else {
216214
// preserve previous array contents
217215
v_resize_array(var_p, size);

0 commit comments

Comments
 (0)