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] Unused nested generics unable to compile #617

Open
thareh opened this issue Apr 26, 2023 · 1 comment
Open

[Generics] Unused nested generics unable to compile #617

thareh opened this issue Apr 26, 2023 · 1 comment

Comments

@thareh
Copy link
Contributor

thareh commented Apr 26, 2023

Good day,

Using the following code will cause a lot of compilation errors.

test.mod/generics.mod/generics.bmx

SuperStrict

Module Test.Generics

Framework BRL.Blitz
Import BRL.Collections

Type TTempMap<K, V>
	
	Field map:TTreeMap<K, V> = New TTreeMap<K, V>()
	
EndType

example.bmx

SuperStrict

Framework BRL.Blitz
Import BRL.StandardIO
Import Test.Generics

Local map:TTempMap<String, String> = New TTempMap<String, String>()

'If map.map
'	Print 1
'EndIf

Print "DONE"

If you uncomment the if-block it works.

Thanks!

@GWRon
Copy link
Contributor

GWRon commented Dec 28, 2023

With latest bcc the modules can no longer use framework.

you need to use:

SuperStrict
Module Test.Generics

Import BRL.Blitz
Import BRL.Collections

Type TTempMap<K, V>
	
	Field map:TTreeMap<K, V> = New TTreeMap<K, V>()
	
EndType

It blamed an incorrect module line at the first try but then in the second processed a bit more until it errored out:

Building untitled2
[ 14%] Processing:generics.bmx
[ 88%] Compiling:generics.bmx.release.linux.x64.c
[ 91%] Compiling:untitled2.bmx.console.release.linux.x64.c
In file included from /home/ronny/Arbeit/Tools/BlitzMaxNG/tmp/.bmx/untitled2.bmx.console.release.linux.x64.c:1:
/home/ronny/Arbeit/Tools/BlitzMaxNG/tmp/.bmx/untitled2.bmx.console.release.linux.x64.h:637:20: error: conflicting types for �bbbrl_blitz_IIterator_Current_m�; have �BBString * (*)(struct bbbrl_blitz_IIterator_obj *)�
  637 | typedef BBSTRING (*bbbrl_blitz_IIterator_Current_m)(struct bbbrl_blitz_IIterator_obj*);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ronny/Arbeit/Tools/BlitzMaxNG/tmp/.bmx/untitled2.bmx.console.release.linux.x64.h:340:47: note: previous declaration of �bbbrl_blitz_IIterator_Current_m� with type �bbbrl_blitz_IIterator_Current_m� {aka �struct _m_untitled2_TMapNodeSS_obj * (*)(struct bbbrl_blitz_IIterator_obj *)�}
  340 | typedef struct _m_untitled2_TMapNodeSS_obj* (*bbbrl_blitz_IIterator_Current_m)(struct bbbrl_blitz_IIterator_obj*);
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ronny/Arbeit/Tools/BlitzMaxNG/tmp/.bmx/untitled2.bmx.console.release.linux.x64.h:638:10: error: conflicting types for �_bbbrl_blitz_IIterator_Current�; have �BBString *(struct bbbrl_blitz_IIterator_obj *)�
  638 | BBSTRING _bbbrl_blitz_IIterator_Current(struct bbbrl_blitz_IIterator_obj*);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ronny/Arbeit/Tools/BlitzMaxNG/tmp/.bmx/untitled2.bmx.console.release.linux.x64.h:341:37: note: previous declaration of �_bbbrl_blitz_IIterator_Current� with type �struct _m_untitled2_TMapNodeSS_obj *(struct bbbrl_blitz_IIterator_obj *)�
  341 | struct _m_untitled2_TMapNodeSS_obj* _bbbrl_blitz_IIterator_Current(struct bbbrl_blitz_IIterator_obj*);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

@thareh thareh changed the title Unused nested generics unable to compile [Generics] Unused nested generics unable to compile Jan 3, 2024
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

2 participants