made some tests green
This commit is contained in:
parent
8ae49eddc8
commit
7b36d3d6ff
6 changed files with 8 additions and 6 deletions
|
|
@ -40,7 +40,8 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||||
# do not produce another redundant error message:
|
# do not produce another redundant error message:
|
||||||
#raiseRecoverableError("")
|
#raiseRecoverableError("")
|
||||||
result = errorNode(c, n)
|
result = errorNode(c, n)
|
||||||
if isEmptyType(result.typ):
|
if result.typ == nil:
|
||||||
|
# we cannot check for 'void' in macros ...
|
||||||
LocalError(n.info, errExprXHasNoType,
|
LocalError(n.info, errExprXHasNoType,
|
||||||
renderTree(result, {renderNoComments}))
|
renderTree(result, {renderNoComments}))
|
||||||
result.typ = errorType(c)
|
result.typ = errorType(c)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ proc semDestructorCheck(c: PContext, n: PNode, flags: TExprFlags) {.inline.} =
|
||||||
if instantiateDestructor(c, n.typ):
|
if instantiateDestructor(c, n.typ):
|
||||||
LocalError(n.info, errGenerated,
|
LocalError(n.info, errGenerated,
|
||||||
"usage of a type with a destructor in a non destructible context")
|
"usage of a type with a destructor in a non destructible context")
|
||||||
if efDetermineType notin flags and n.typ.kind == tyTypeDesc:
|
if efDetermineType notin flags and n.typ.kind == tyTypeDesc and
|
||||||
|
c.p.owner.kind notin {skTemplate, skMacro}:
|
||||||
localError(n.info, errGenerated, "value expected, but got a type")
|
localError(n.info, errGenerated, "value expected, but got a type")
|
||||||
|
|
||||||
proc newDeref(n: PNode): PNode {.inline.} =
|
proc newDeref(n: PNode): PNode {.inline.} =
|
||||||
|
|
|
||||||
|
|
@ -792,7 +792,7 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
|
||||||
result = instGenericContainer(c, n, result)
|
result = instGenericContainer(c, n, result)
|
||||||
|
|
||||||
proc semTypeExpr(c: PContext, n: PNode): PType =
|
proc semTypeExpr(c: PContext, n: PNode): PType =
|
||||||
var n = semExprWithType(c, n)
|
var n = semExprWithType(c, n, {efDetermineType})
|
||||||
if n.kind == nkSym and n.sym.kind == skType:
|
if n.kind == nkSym and n.sym.kind == skType:
|
||||||
result = n.sym.typ
|
result = n.sym.typ
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "system.nim"
|
file: "system.nim"
|
||||||
line: 695
|
line: 696
|
||||||
errormsg: "type mismatch"
|
errormsg: "type mismatch"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ template Additive(typ: typeDesc): stmt =
|
||||||
proc `+` *(x: typ): typ {.borrow.}
|
proc `+` *(x: typ): typ {.borrow.}
|
||||||
proc `-` *(x: typ): typ {.borrow.}
|
proc `-` *(x: typ): typ {.borrow.}
|
||||||
|
|
||||||
template Multiplicative(typ, base: typeDesc): stmt =
|
template Multiplicative(typ, base: typeDesc): stmt {.immediate.} =
|
||||||
proc `*` *(x: typ, y: base): typ {.borrow.}
|
proc `*` *(x: typ, y: base): typ {.borrow.}
|
||||||
proc `*` *(x: base, y: typ): typ {.borrow.}
|
proc `*` *(x: base, y: typ): typ {.borrow.}
|
||||||
proc `div` *(x: typ, y: base): typ {.borrow.}
|
proc `div` *(x: typ, y: base): typ {.borrow.}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
output: "direct\nopenarray\nvarargs"
|
output: "direct\ngeneric\ngeneric"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc withDirectType(args: string) =
|
proc withDirectType(args: string) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue