ZScript lumps: redefining class attribute should cause error

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

ZScript lumps: redefining class attribute should cause error

Post by m8f »

Consider two mods: ab-top-level.pk3 and ab-included.pk3. Their structure is:

ab-top-level.pk3:
zscript.a:

Code: Select all

Class A { int i; }
zscript.b

Code: Select all

Class B : A { int i; }
ab-included.pk3:
zscript.txt:

Code: Select all

version "3.2.0"

#include "a.zsc"
#include "b.zsc"
a.zsc:

Code: Select all

Class A { int i; }
b.zsc:

Code: Select all

Class B : A { int i; }
Note that zscript.a has exactly the same contents as a.zsc, and zscript.b has exactly the same contents as b.zsc.

When ab-included.pk3 is loaded, GZDoom produces the following message:

Code: Select all

ab-included.pk3:b.zsc, line 1: Attempt to redefine 'i'
ab-included.pk3:a.zsc, line 1:  Original definition is here
and fails to run. This is normal behavior, because "int i" attribute is already present in class B because it is inherited from A, which defined this attribute.

Now the twist: ab-top-level.pk3 is loaded without errors! I'm not sure how the two files are merged together, but they are both loaded.

Expected result: loading attempt of ab-top-level.pk3 produces error about 'i' redefinition.
Actual result: ab-top-level.pk3 is loaded fine.
ab-top-level.pk3
(252 Bytes) Downloaded 70 times
ab-included.pk3
(374 Bytes) Downloaded 72 times

Return to “Bugs [GZDoom]”