Skip to content

Commit 6395a7c

Browse files
committed
add changelog entry, fix double not nil bug
1 parent f028f7e commit 6395a7c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@
142142
need to convert to `string`. On the JS backend, this is translated directly
143143
to a `switch` statement.
144144

145+
- `foo a = b` now means `foo(a = b)` rather than `foo(a) = b`. This is consistent
146+
with the existing behavior of `foo a, b = c` meaning `foo(a, b = c)`.
147+
This decision was made with the assumption that the old syntax was used rarely;
148+
if your code used the old syntax, please be aware of this change.
149+
145150
## Compiler changes
146151

147152
- The `gc` switch has been renamed to `mm` ("memory management") in order to reflect the

compiler/parser.nim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,9 +1393,7 @@ proc parseTypeDefValue(p: var Parser): PNode =
13931393
result = parseTypeClass(p)
13941394
else:
13951395
result = simpleExpr(p, pmTypeDef)
1396-
if p.tok.tokType == tkNot:
1397-
result = binaryNot(p, result)
1398-
else:
1396+
if p.tok.tokType != tkNot:
13991397
if result.kind == nkCommand:
14001398
var isFirstParam = false
14011399
while p.tok.tokType == tkComma:

tests/parser/tdoublenotnil.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
when false:
2+
type Foo = Bar not nil not nil #[tt.Error
3+
^ invalid indentation]#

0 commit comments

Comments
 (0)