Page 1 of 1

mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:02 am
by JPL
A mod I released last year has started failing on startup in recent-ish versions of GZDoom. 4 errors that all say "Invalid statement", two of them on the same line. A couple of the lines in question are simple function overrides, eg
Code: Select allExpand view
override void PostBeginPlay()
, and no further information is given so it's pretty unclear what the real problem is or how to fix it.

You can download the latest released version of the mod here: https://jp.itch.io/mr-friendly

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:40 am
by _mental_
It's caused by no-op expressions, like
Code: Select allExpand view
if (const_evaluated_to_false) // ...

I think this should be fixed like this.

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:45 am
by Graf Zahl
Wouldn't it be better to give FxNop a non-error type instead?

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:47 am
by _mental_
Probably, yes. Actually, I thought TypeError was used to catch errors like this.

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:51 am
by Graf Zahl
Errors, yes, but this should at most be a warning.

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 3:53 am
by _mental_
It's a code generation error because construct with a constant condition is valid.

TypeVoid for FxNop fixes the issue as well. Should we prefer this solution over my PR?

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 4:45 am
by Graf Zahl
_mental_ wrote:It's a code generation error because construct with a constant condition is valid.


Yes, but that means that FxNop may not have an error type. FxNop is meant as a valid stand-in for an empty statement where null is not viable.

Re: mysterious "Invalid statement" Zscript errors

PostPosted: Wed Feb 06, 2019 5:10 am
by _mental_
Fixed in 78c0b7f.