Resize of empty arrays
Monkey Forums/Monkey Bug Reports/Resize of empty arrays
| ||
Hi,Strict
Function Main:Int()
Local empty:Int[] = [].Resize(5)
Print "Empty Resize Lenght: " + empty.Length()
Local filled:Int[] = [0].Resize(5)
Print "Filled Resize Lenght: " + filled.Length()
Return 0
Endleads to ** BUILD SUCCEEDED ** Empty Resize Lenght: 0 Filled Resize Lenght: 5 which seems to be a bug :/ |
| ||
| Hi, i've wrote some tests to make this case a little bit more specific. The code can be found here and to reproduce this, just compile & run the runall.monkey file. Running debug cpp/glfw tests on macos:
bugs.resizeemptyarraytest.ResizeEmptyArrayTest
TestResizeWithItems
TestResizeEmptyAfterAssignment
TestResizeEmptyDirect [FAILED]
There was 1 failure:
1) ResizeEmptyArrayTest.TestResizeEmptyDirect in bugs/resizeemptyarraytest.monkey
Failed asserting that two integers are equal
Expected: 1
Actual : 0
FAILURES!
Tests: 3, Failed: 1, Skipped: 0, Incomplete: 0.All the best, Michael PS: The used testing framework is part of bono and can be found here. |
| ||
| Nice bug! [].Resize() shouldn't actually compile in the first place (what type would the elements have?!?) - will fix. |