mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 06:23:25 +00:00
Fix parser bug with type classes (#7480)
This commit is contained in:
committed by
Andreas Rumpf
parent
8b7c2bd067
commit
d6793ded27
@@ -1080,6 +1080,7 @@ proc parseTypeDescKAux(p: var TParser, kind: TNodeKind,
|
||||
#| distinct = 'distinct' optInd typeDesc
|
||||
result = newNodeP(kind, p)
|
||||
getTok(p)
|
||||
if p.tok.indent != -1 and p.tok.indent <= p.currInd: return
|
||||
optInd(p, result)
|
||||
if not isOperator(p.tok) and isExprStart(p):
|
||||
addSon(result, primary(p, mode))
|
||||
|
||||
17
tests/parser/ttypeclasses.nim
Normal file
17
tests/parser/ttypeclasses.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
discard """
|
||||
action: run
|
||||
"""
|
||||
|
||||
type
|
||||
R = ref
|
||||
V = var
|
||||
D = distinct
|
||||
P = ptr
|
||||
|
||||
var x: ref int
|
||||
var y: distinct int
|
||||
var z: ptr int
|
||||
|
||||
doAssert x is ref
|
||||
doAssert y is distinct
|
||||
doAssert z is ptr
|
||||
Reference in New Issue
Block a user