From aa62fabe26a4e1ee1674010f65da00f2d88920b3 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Tue, 26 Apr 2022 13:50:27 +0100 Subject: [PATCH] Fix another place where type could be nil --- extractor/extractor.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extractor/extractor.go b/extractor/extractor.go index f3826e3ad7f..7f7f1cae677 100644 --- a/extractor/extractor.go +++ b/extractor/extractor.go @@ -940,10 +940,18 @@ func extractExpr(tw *trap.Writer, expr ast.Expr, parent trap.Label, idx int) { if expr == nil { return } - if _, ok := typeOf(tw, expr.X).Underlying().(*types.Signature); ok { - kind = dbscheme.GenericFunctionInstantiationExpr.Index() - } else { + typeofx := typeOf(tw, expr.X) + if typeofx == nil { + // We are missing type information for `expr.X`, so we cannot + // determine whether this is a generic function instantiation + // or not. kind = dbscheme.GenericTypeInstantiationExpr.Index() + } else { + if _, ok := typeofx.Underlying().(*types.Signature); ok { + kind = dbscheme.GenericFunctionInstantiationExpr.Index() + } else { + kind = dbscheme.GenericTypeInstantiationExpr.Index() + } } extractExpr(tw, expr.X, lbl, 0) extractExprs(tw, expr.Indices, lbl, 1, 1)