ZScript lumps: redefining class attribute should cause error

Fri Feb 15, 2019 6:43 am

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

ab-top-level.pk3:
zscript.a:
Code:
Class A { int i; }

zscript.b
Code:
Class B : A { int i; }


ab-included.pk3:
zscript.txt:
Code:
version "3.2.0"

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

a.zsc:
Code:
Class A { int i; }

b.zsc:
Code:
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:
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

ab-included.pk3
You do not have the required permissions to view the files attached to this post.