Fix effect section errors getting overridden by UnderscoreTud · Pull Request #8498 · SkriptLang/Skript

Problem

When the section element of an EffectSection errors, but the effect element of it succeeds and later errors due to no syntaxes claiming the section. The user logged errors get overridden by a generic "X is a valid statement but cannot function as a section (:) because there is no syntax in the line to manage it." error.

Solution

Only override the section's error if it doesn't include an explicitly logged error by the user.

Testing Completed

effect section error.sk and manual testing.

Supporting Information

Quick rundown of what happens:

erroring effect section:
    ...
  1. tries to parse the effect section as a section -> succeeds
  2. tries to call init -> fails with explicit error
  3. tries to parse the effect on its own -> succeeds
  4. tries to see if any expression claimed the section -> fails
  5. prints can't claim section (overrides explicit error)

Completes: none
Related: none
AI assistance: none