bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

[collections.mod] LinkedList empty string issue #606

Closed thareh closed 1 year ago

thareh commented 2 years ago

Hey,

The following will not work as expected:

Framework BRL.Blitz
Import BRL.StandardIO
Import BRL.Collections

Local list:TLinkedList<String> = New TLinkedList<String>()

list.AddLast("foo")
list.AddLast("")
list.AddLast("bar")

Print list.Count()

For Local s:String = EachIn list
    Print s
Next

Thanks! -- Thareh

thareh commented 2 years ago

Also note that string[] and TList behaves properly with empty strings.

thareh commented 2 years ago

Might be a bug in BCC as I can't find anything wrong with the code.

thareh commented 1 year ago

Seems to go through the if block at bcc/parser.bmx:315 to add the expression:

if(bbStringEquals(bbt_i, (&bbEmptyString))==1){
     continue;
}

Perhaps there is a way to check if the foreach is on a generic type and don't add this expression here. I'll keep on experimenting.