fix #945
This commit is contained in:
parent
0bbf6081d0
commit
1a6d05515f
2 changed files with 8 additions and 6 deletions
|
|
@ -143,10 +143,11 @@ proc discardCheck(c: PContext, result: PNode) =
|
||||||
while n.kind in skipForDiscardable:
|
while n.kind in skipForDiscardable:
|
||||||
n = n.lastSon
|
n = n.lastSon
|
||||||
n.typ = nil
|
n.typ = nil
|
||||||
elif c.inTypeClass > 0 and result.typ.kind == tyBool:
|
elif c.inTypeClass > 0:
|
||||||
let verdict = semConstExpr(c, result)
|
if result.typ.kind == tyBool:
|
||||||
if verdict.intVal == 0:
|
let verdict = semConstExpr(c, result)
|
||||||
localError(result.info, "type class predicate failed")
|
if verdict.intVal == 0:
|
||||||
|
localError(result.info, "type class predicate failed")
|
||||||
elif result.typ.kind != tyError and gCmd != cmdInteractive:
|
elif result.typ.kind != tyError and gCmd != cmdInteractive:
|
||||||
if result.typ.kind == tyNil:
|
if result.typ.kind == tyNil:
|
||||||
fixNilType(result)
|
fixNilType(result)
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,10 @@ proc intval(x: int) = discard
|
||||||
# check real and virtual fields
|
# check real and virtual fields
|
||||||
type
|
type
|
||||||
TFoo = generic T
|
TFoo = generic T
|
||||||
intval T.x
|
T.x
|
||||||
|
y(T)
|
||||||
intval T.y
|
intval T.y
|
||||||
|
|
||||||
proc y(x: TObj): int = 10
|
proc y(x: TObj): int = 10
|
||||||
|
|
||||||
proc testFoo(x: TFoo) = discard
|
proc testFoo(x: TFoo) = discard
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue