@@ -437,7 +437,7 @@ func (p *parser) InstantiateGenericFunction(genericFunc *ast.FuncDecl, genericTy
437437
438438 if ast .IsExternFunc (genericFunc ) {
439439 // add the instantiation to prevent recursion
440- genericFunc .Generic .Instantiations [p . module ] = append (genericFunc .Generic .Instantiations [p .module ], & decl )
440+ genericFunc .Generic .Instantiations [genericModule ] = append (genericFunc .Generic .Instantiations [p .module ], & decl )
441441 return & decl , nil
442442 }
443443
@@ -461,16 +461,15 @@ func (p *parser) InstantiateGenericFunction(genericFunc *ast.FuncDecl, genericTy
461461 declParser .setScope (context .Symbols )
462462
463463 // add the instantiation to prevent recursion
464- genericFunc .Generic .Instantiations [p . module ] = append (genericFunc .Generic .Instantiations [p . module ], & decl )
464+ genericFunc .Generic .Instantiations [genericModule ] = append (genericFunc .Generic .Instantiations [genericModule ], & decl )
465465
466466 declParser .advance () // skip the colon for blockStatement()
467467 decl .Body = declParser .blockStatement (declParser .scope ()).(* ast.BlockStmt )
468468 declParser .ensureReturnStatementPresent (& decl , decl .Body )
469469
470470 if errorCollector .DidError () {
471471 // remove the instantiation as we errored
472- genericFunc .Generic .Instantiations [p .module ] = slices .DeleteFunc (genericFunc .Generic .Instantiations [p .module ], func (f * ast.FuncDecl ) bool { return f == & decl })
473- return & decl , errorCollector .Errors
472+ genericFunc .Generic .Instantiations [genericModule ] = slices .DeleteFunc (genericFunc .Generic .Instantiations [genericModule ], func (f * ast.FuncDecl ) bool { return f == & decl })
474473 }
475474
476475 return & decl , errorCollector .Errors
0 commit comments