Skip to content

Conversation

@mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Nov 5, 2025

🤔 What's changed?

Improved the error message for cases where an operand is missing.
Unfortunately the parsing algorithm can't detect which operator is
missing operands so the error message must remain fairly generic.

⚡️ What's your motivation?

Fixes: #196

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@mpkorstanje mpkorstanje changed the title Harmonize missing operands error Improve error message for missing operands Nov 7, 2025
@mpkorstanje mpkorstanje marked this pull request as ready for review November 7, 2025 18:29
Copy link
Contributor

@ehuelsmann ehuelsmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does look good. But I cannot trace why this custom pop method was ever used.

But given what you've written and the error examples I can clearly see that for each of them it would be almost impossible to work out "what" the problem is. i.e. for a and is the problem the and or the missing second item.

Overall it's a 👍 from me, but I can't quite trace / understand the logic

@clrudolphi
Copy link

Question: in the addition to the errors test data, I notice that the tests being added are adding a new error message rather than reusing an existing one.

The input a and is resulting in an error message about an incomplete expression rather than reusing the existing error message about a missing expected operand.

Why the difference?

@mpkorstanje
Copy link
Contributor Author

Question: in the addition to the errors test data, I notice that the tests being added are adding a new error message rather than reusing an existing one.

Good point. Addressed by d2d19c5

@mpkorstanje
Copy link
Contributor Author

This does look good. But I cannot trace why this custom pop method was ever used.

I don't know either. I suspect it was an over abundance of caution.

@mpkorstanje mpkorstanje merged commit eb1e717 into main Nov 9, 2025
43 checks passed
@mpkorstanje mpkorstanje deleted the fix/196-insufficient-operands branch November 9, 2025 16:37
clrudolphi added a commit that referenced this pull request Nov 9, 2025
…ken ToString() should be empty string rather than "true").
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

Successfully merging this pull request may close these issues.

Expressions not having enough operands are not covered by the test data.

5 participants