From 950f2d7c2f60425155e5f3b902ed067f2e3d2d17 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 28 May 2019 21:58:59 +0200 Subject: [PATCH] fixes #6755; error message could be better but oh well --- compiler/liftdestructors.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index c797f3ed30..18f9674655 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -579,10 +579,12 @@ proc patchBody(c: PContext; n: PNode; info: TLineInfo) = template inst(field, t) = if field.ast != nil and field.ast[genericParamsPos].kind != nkEmpty: - assert t.typeInst != nil - field = c.instTypeBoundOp(c, field, t.typeInst, info, attachedAsgn, 1) - if field.ast != nil: - patchBody(c, field.ast, info) + if t.typeInst != nil: + field = c.instTypeBoundOp(c, field, t.typeInst, info, attachedAsgn, 1) + if field.ast != nil: + patchBody(c, field.ast, info) + else: + localError(c.graph.config, info, "unresolved generic parameter") proc isTrival(s: PSym): bool {.inline.} = s == nil or s.ast[bodyPos].len == 0