mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 23:41:29 +00:00
fix #945
This commit is contained in:
@@ -143,10 +143,11 @@ proc discardCheck(c: PContext, result: PNode) =
|
||||
while n.kind in skipForDiscardable:
|
||||
n = n.lastSon
|
||||
n.typ = nil
|
||||
elif c.inTypeClass > 0 and result.typ.kind == tyBool:
|
||||
let verdict = semConstExpr(c, result)
|
||||
if verdict.intVal == 0:
|
||||
localError(result.info, "type class predicate failed")
|
||||
elif c.inTypeClass > 0:
|
||||
if result.typ.kind == tyBool:
|
||||
let verdict = semConstExpr(c, result)
|
||||
if verdict.intVal == 0:
|
||||
localError(result.info, "type class predicate failed")
|
||||
elif result.typ.kind != tyError and gCmd != cmdInteractive:
|
||||
if result.typ.kind == tyNil:
|
||||
fixNilType(result)
|
||||
|
||||
@@ -31,9 +31,10 @@ proc intval(x: int) = discard
|
||||
# check real and virtual fields
|
||||
type
|
||||
TFoo = generic T
|
||||
intval T.x
|
||||
T.x
|
||||
y(T)
|
||||
intval T.y
|
||||
|
||||
|
||||
proc y(x: TObj): int = 10
|
||||
|
||||
proc testFoo(x: TFoo) = discard
|
||||
|
||||
Reference in New Issue
Block a user