Skip to content

Commit

Permalink
Crystal Not operators do not need parens (#15292)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blacksmoke16 authored Dec 20, 2024
1 parent 69345ba commit b6b190f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/compiler/parser/to_s_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe "ASTNode#to_s" do
expect_to_s "1e10_f64", "1e10"
expect_to_s "!a"
expect_to_s "!(1 < 2)"
expect_to_s "!a.b && true"
expect_to_s "(1 + 2)..3"
expect_to_s "macro foo\n{{ @type }}\nend"
expect_to_s "macro foo\n\\{{ @type }}\nend"
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/to_s.cr
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ module Crystal
end
when Var, NilLiteral, BoolLiteral, CharLiteral, NumberLiteral, StringLiteral,
StringInterpolation, Path, Generic, InstanceVar, ClassVar, Global,
ImplicitObj, TupleLiteral, NamedTupleLiteral, IsA
ImplicitObj, TupleLiteral, NamedTupleLiteral, IsA, Not
false
when ArrayLiteral
!!obj.of
Expand Down

0 comments on commit b6b190f

Please sign in to comment.