Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit aa62fab

Browse files
owen-mcsmowton
authored andcommitted
Fix another place where type could be nil
1 parent 06d1398 commit aa62fab

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

extractor/extractor.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,10 +940,18 @@ func extractExpr(tw *trap.Writer, expr ast.Expr, parent trap.Label, idx int) {
940940
if expr == nil {
941941
return
942942
}
943-
if _, ok := typeOf(tw, expr.X).Underlying().(*types.Signature); ok {
944-
kind = dbscheme.GenericFunctionInstantiationExpr.Index()
945-
} else {
943+
typeofx := typeOf(tw, expr.X)
944+
if typeofx == nil {
945+
// We are missing type information for `expr.X`, so we cannot
946+
// determine whether this is a generic function instantiation
947+
// or not.
946948
kind = dbscheme.GenericTypeInstantiationExpr.Index()
949+
} else {
950+
if _, ok := typeofx.Underlying().(*types.Signature); ok {
951+
kind = dbscheme.GenericFunctionInstantiationExpr.Index()
952+
} else {
953+
kind = dbscheme.GenericTypeInstantiationExpr.Index()
954+
}
947955
}
948956
extractExpr(tw, expr.X, lbl, 0)
949957
extractExprs(tw, expr.Indices, lbl, 1, 1)

0 commit comments

Comments
 (0)