Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Generics] Crash, Possible C code casting bug? #657

Open
thareh opened this issue Apr 10, 2024 · 2 comments
Open

[Generics] Crash, Possible C code casting bug? #657

thareh opened this issue Apr 10, 2024 · 2 comments

Comments

@thareh
Copy link
Contributor

thareh commented Apr 10, 2024

Good day,

Seems like I found another generics bug:

Framework BRL.Blitz
Import BRL.StandardIO

'Switch these
Import "Import2.bmx"
Import "Import1.bmx"

TFoo.map["test"] = "test"
TBar.map["test"] = "test"

For Local key:String = EachIn TFoo.map.Keys()
	Print TFoo.map[key]
Next

For Local key:String = EachIn TBar.map.Keys()
	Print TBar.map[key]
Next

Import1.bmx

Framework BRL.Blitz
Import BRL.Collections

Type TFoo
	
	Global map:TTreeMap<String, String> = New TTreeMap<String, String>()
	
EndType

Import2.bmx

Framework BRL.Blitz
Import BRL.Collections

Type TBar
	
	Global map:TTreeMap<String, String> = New TTreeMap<String, String>()
	
EndType

Seems the casting in the C code produced is wrong.

If you compile this, and have a look at the C code and then switch the order of the imports you'll see that the casting of the last import is applied "everywhere". (Sorry, can't find the proper words)

Anyway, not 100% sure that this is the issue, but that's my guess.

Thanks!

@thareh thareh changed the title [Generics] Possible C code casting bug? [Generics] Crash, Possible C code casting bug? Apr 10, 2024
@thareh
Copy link
Contributor Author

thareh commented Apr 10, 2024

Any chance you have time to take a look at this? @woollybah

@thareh
Copy link
Contributor Author

thareh commented Apr 21, 2024

I've been experimenting in the blind, trying to find the issue - but I can't for the life of me figure it out. Seems to me like BCC equates the two classes and thus uses the second ones scope where it shouldn't.

Will be very interesting to see what the solution is!

Cheers.

thareh referenced this issue in bmx-ng/brl.mod Jul 19, 2024
Added time Enqueue and Dequeue methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant