Skip to content

Commit 01a5bcc

Browse files
author
Michal Medvecky
committed
test_grammar test fix
1 parent 318bc7a commit 01a5bcc

File tree

2 files changed

+5
-0
lines changed
  • graalpython

2 files changed

+5
-0
lines changed

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags_bytecode_dsl/test_grammar.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ test.test_grammar.GrammarTests.test_additive_ops @ linux-x86_64
22
test.test_grammar.GrammarTests.test_annotations_inheritance @ linux-x86_64
33
test.test_grammar.GrammarTests.test_assert @ linux-x86_64
44
test.test_grammar.GrammarTests.test_assert_failures @ linux-x86_64
5+
test.test_grammar.GrammarTests.test_assert_syntax_warnings @ linux-x86_64
6+
test.test_grammar.GrammarTests.test_assert_warning_promotes_to_syntax_error @ linux-x86_64
57
test.test_grammar.GrammarTests.test_async_await @ linux-x86_64
68
test.test_grammar.GrammarTests.test_async_for @ linux-x86_64
79
test.test_grammar.GrammarTests.test_async_with @ linux-x86_64

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,6 +2909,9 @@ private void checkAnnSubscr(ExprTy expr) {
29092909
public Void visit(StmtTy.Assert node) {
29102910
if (ctx.optimizationLevel <= 0) {
29112911
boolean newStatement = beginSourceSection(node, b);
2912+
if (node.test instanceof ExprTy.Tuple && ((Tuple) node.test).elements.length > 0) {
2913+
ctx.errorCallback.onWarning(WarningType.Syntax, currentLocation, "assertion is always true, perchance remove parentheses?");
2914+
}
29122915
b.beginIfThen();
29132916

29142917
b.beginNot();

0 commit comments

Comments
 (0)