Skip to content

Fix ExprKind::BoolOp location #4306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2022

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Dec 3, 2022

Fix #4305.

@harupy
Copy link
Contributor Author

harupy commented Dec 3, 2022

Should I add tests?

diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs
index d0f71fc80..f120dae70 100644
--- a/compiler/parser/src/parser.rs
+++ b/compiler/parser/src/parser.rs
@@ -218,4 +218,18 @@ class Foo(A, B):
         let parse_ast = parse_expression(&source, "<test>").unwrap();
         insta::assert_debug_snapshot!(parse_ast);
     }
+
+    #[test]
+    fn test_parse_boolop_or() {
+        let source = String::from("x or y");
+        let parse_ast = parse_expression(&source, "<test>").unwrap();
+        insta::assert_debug_snapshot!(parse_ast);
+    }
+
+    #[test]
+    fn test_parse_boolop_and() {
+        let source = String::from("x and y");
+        let parse_ast = parse_expression(&source, "<test>").unwrap();
+        insta::assert_debug_snapshot!(parse_ast);
+    }
 }

Added.

@DimitrisJim
Copy link
Member

Thanks! test_boolop in EndPositionTests is passing (file test_ast.py). Remove the decorator on it to get the stdlib tests to pass again.

@harupy
Copy link
Contributor Author

harupy commented Dec 4, 2022

@DimitrisJim Removed!

@harupy
Copy link
Contributor Author

harupy commented Dec 5, 2022

@DimitrisJim Is the CI / Run rust tests (ubuntu-latest) (pull_request) failure related to this PR?

Copy link
Member

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

failure is unrelated. looks good to me, thanks again!

@DimitrisJim DimitrisJim merged commit 28f9f65 into RustPython:main Dec 5, 2022
@harupy
Copy link
Contributor Author

harupy commented Dec 5, 2022

cc @charliermarsh

@harupy harupy deleted the fix-boolop-location branch December 5, 2022 00:44
@charliermarsh
Copy link
Collaborator

Rad, thanks @harupy!

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.

Is the start location of ExprKind::BoolOp correct?
3 participants