mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
require not nil to be on the same line after a type (#24134)
fixes #23565
This commit is contained in:
@@ -1401,7 +1401,7 @@ proc primary(p: var Parser, mode: PrimaryMode): PNode =
|
||||
result = primarySuffix(p, result, baseInd, mode)
|
||||
|
||||
proc binaryNot(p: var Parser; a: PNode): PNode =
|
||||
if p.tok.tokType == tkNot:
|
||||
if p.tok.tokType == tkNot and p.tok.indent < 0:
|
||||
let notOpr = newIdentNodeP(p.tok.ident, p)
|
||||
getTok(p)
|
||||
optInd(p, notOpr)
|
||||
|
||||
3
tests/parser/tbinarynotindented.nim
Normal file
3
tests/parser/tbinarynotindented.nim
Normal file
@@ -0,0 +1,3 @@
|
||||
type Foo = ref int
|
||||
not nil #[tt.Error
|
||||
^ invalid indentation]#
|
||||
10
tests/parser/tbinarynotsameline.nim
Normal file
10
tests/parser/tbinarynotsameline.nim
Normal file
@@ -0,0 +1,10 @@
|
||||
# issue #23565
|
||||
|
||||
func foo: bool =
|
||||
true
|
||||
|
||||
const bar = block:
|
||||
type T = int
|
||||
not foo()
|
||||
|
||||
doAssert not bar
|
||||
Reference in New Issue
Block a user