mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
@@ -1259,6 +1259,9 @@ proc typeSectionTypeName(c: PContext; n: PNode): PNode =
|
||||
result = n[0]
|
||||
else:
|
||||
result = n
|
||||
if result.kind == nkPostfix:
|
||||
if result.len != 2: illFormedAst(n, c.config)
|
||||
result = result[1]
|
||||
if result.kind != nkSym: illFormedAst(n, c.config)
|
||||
|
||||
proc typeDefLeftSidePass(c: PContext, typeSection: PNode, i: int) =
|
||||
@@ -1326,9 +1329,15 @@ proc typeDefLeftSidePass(c: PContext, typeSection: PNode, i: int) =
|
||||
elif s.owner == nil: s.owner = getCurrOwner(c)
|
||||
|
||||
if name.kind == nkPragmaExpr:
|
||||
typeDef[0][0] = newSymNode(s)
|
||||
if name[0].kind == nkPostfix:
|
||||
typeDef[0][0][1] = newSymNode(s)
|
||||
else:
|
||||
typeDef[0][0] = newSymNode(s)
|
||||
else:
|
||||
typeDef[0] = newSymNode(s)
|
||||
if name.kind == nkPostfix:
|
||||
typeDef[0][1] = newSymNode(s)
|
||||
else:
|
||||
typeDef[0] = newSymNode(s)
|
||||
|
||||
proc typeSectionLeftSidePass(c: PContext, n: PNode) =
|
||||
# process the symbols on the left side for the whole type section, before
|
||||
@@ -1538,8 +1547,15 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
|
||||
of nkSym: obj.ast[0] = symNode
|
||||
of nkPragmaExpr:
|
||||
obj.ast[0] = a[0].shallowCopy
|
||||
obj.ast[0][0] = symNode
|
||||
if a[0][0].kind == nkPostfix:
|
||||
obj.ast[0][0] = a[0][0].shallowCopy
|
||||
obj.ast[0][0][1] = symNode
|
||||
else:
|
||||
obj.ast[0][0] = symNode
|
||||
obj.ast[0][1] = a[0][1]
|
||||
of nkPostfix:
|
||||
obj.ast[0] = a[0].shallowCopy
|
||||
obj.ast[0][1] = symNode
|
||||
else: assert(false)
|
||||
obj.ast[1] = a[1]
|
||||
obj.ast[2] = a[2][0]
|
||||
|
||||
@@ -97,7 +97,8 @@ pkg "memo"
|
||||
pkg "msgpack4nim", "nim c -r tests/test_spec.nim"
|
||||
pkg "nake", "nim c nakefile.nim"
|
||||
pkg "neo", "nim c -d:blas=openblas --mm:refc tests/all.nim", url = "https://github.com/nim-lang/neo"
|
||||
pkg "nesm", "nimble tests", "https://github.com/nim-lang/NESM", useHead = true
|
||||
pkg "nesm", "nimble tests", "https://github.com/nim-lang/NESM", useHead = true, allowFailure = true
|
||||
# inactive, tests not adapted to #23096
|
||||
pkg "netty"
|
||||
pkg "nico", allowFailure = true
|
||||
pkg "nicy", "nim c -r src/nicy.nim"
|
||||
|
||||
@@ -11,6 +11,8 @@ for i, (x, y) in pairs(data):
|
||||
var
|
||||
a = 1
|
||||
b = 2
|
||||
type
|
||||
A* = object
|
||||
|
||||
var data = @[(1, "one"), (2, "two")]
|
||||
for (i, d) in pairs(data):
|
||||
@@ -20,6 +22,8 @@ for i, d in pairs(data):
|
||||
for i, (x, y) in pairs(data):
|
||||
discard
|
||||
var (a, b) = (1, 2)
|
||||
type
|
||||
A* = object
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -44,3 +48,4 @@ echoTypedAndUntypedRepr:
|
||||
for i, (x,y) in pairs(data):
|
||||
discard
|
||||
var (a,b) = (1,2)
|
||||
type A* = object # issue #22933
|
||||
|
||||
@@ -75,7 +75,9 @@ assert: check_gen_proc(len(a)) == (false, true)
|
||||
macro check(x: type): untyped =
|
||||
let z = getType(x)
|
||||
let y = getImpl(z[1])
|
||||
let sym = if y[0].kind == nnkSym: y[0] else: y[0][0]
|
||||
var sym = y[0]
|
||||
if sym.kind == nnkPragmaExpr: sym = sym[0]
|
||||
if sym.kind == nnkPostfix: sym = sym[1]
|
||||
expectKind(z[1], nnkSym)
|
||||
expectKind(sym, nnkSym)
|
||||
expectKind(y[2], nnkObjectTy)
|
||||
|
||||
Reference in New Issue
Block a user