Skip to content

Conversation

@harehare
Copy link
Owner

  • Fix parser to properly handle TokenKind::Not as an unexpected token in specific contexts.
  • Add integration test for double not operator (!!) on booleans.

- Fix parser to properly handle `TokenKind::Not` as an unexpected token in specific contexts.
- Add integration test for double not operator (`!!`) on booleans.
Copilot AI review requested due to automatic review settings January 20, 2026 14:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a parser issue where the double not operator (!!) was not being handled correctly in the mq language. The fix adds TokenKind::Not to the list of unexpected tokens in a specific parsing context, and includes an integration test to verify the double not operator works correctly on boolean values.

Changes:

  • Updated parser logic to properly recognize TokenKind::Not as an unexpected token in specific contexts
  • Added integration test case verifying that !!true correctly evaluates to true

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/mq-lang/src/ast/parser.rs Added TokenKind::Not to the list of tokens triggering an UnexpectedToken error in the parser
crates/mq-lang/tests/integration_tests.rs Added integration test case for double not operator on boolean values

Comment on lines +1907 to +1909
#[case::double_not_true("!!true",
vec![RuntimeValue::Boolean(false)],
Ok(vec![RuntimeValue::Boolean(true)].into()))]
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The test only covers !!true. Consider adding test cases for !!false to ensure the double not operator works correctly for both boolean values.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@harehare I've opened a new pull request, #1119, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: harehare <533078+harehare@users.noreply.github.com>
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 20, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing fix/handle_double_not_operator_and_related_test (225bc88) with main (3663904)1

Summary

✅ 29 untouched benchmarks

Footnotes

  1. No successful run was found on main (e2828c0) during the generation of this report, so 3663904 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Add test coverage for `!!false` operator
@harehare harehare merged commit d65f04a into main Jan 20, 2026
7 checks passed
@harehare harehare deleted the fix/handle_double_not_operator_and_related_test branch January 20, 2026 15:10
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.

2 participants