Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat(core-ingestion): Go parser accuracy and determinism overhaul
Joseph Mikhail7cfed39759fd
diff --git a/core-ingestion/src/__tests__/queries.go.test.ts b/core-ingestion/src/__tests__/queries.go.test.tsindex d9253afa..5eec51c0 100644--- a/core-ingestion/src/__tests__/queries.go.test.ts+++ b/core-ingestion/src/__tests__/queries.go.test.ts@@ -234,4 +234,206 @@ func setup() {predicate: 'CALLS',});});++ it('package-prefixes bare-function CALL dstNames so same-named functions in different packages resolve to disjoint symbols', () => {+ // Two files, two packages, both defining a bare function `addKnownTypes`+ // and a caller (`init()`) that invokes it. Without package prefixing,+ // both CALLs collapse onto the same bare name in the symbol table and+ // resolution becomes non-deterministic (last-write-wins). With prefixing,+ // each CALL points at a distinct package-qualified target.+ const fooResult = parseFile(+ '/repo/foo/register.go',+ `+package foo++var SchemeBuilder = something{}++func addKnownTypes(s *Scheme) error { return nil }++func init() { addKnownTypes(nil) }+ `,+ );+ const barResult = parseFile(+ '/repo/bar/register.go',+ `+package bar++func addKnownTypes(s *Scheme) error { return nil }++func init() { addKnownTypes(nil) }+ `,+ );++ expect(fooResult).not.toBeNull();+ expect(barResult).not.toBeNull();++ // Each init() bare-name CALL should be package-qualified.+ expect(fooResult!.relationships).toContainEqual({+ srcName: 'init',+ dstName: 'foo.addKnownTypes',+ predicate: 'CALLS',+ });+ expect(barResult!.relationships).toContainEqual({+ srcName: 'init',+ dstName: 'bar.addKnownTypes',+ predicate: 'CALLS',+ });++ // Each entity should carry its package as packageScope so the parse-worker+ // can compose the symbol-table key as `pkg.name`.+ for (const e of fooResult!.entities) {+ if (e.kind === 'function') expect(e.packageScope).toBe('foo');+ }+ for (const e of barResult!.entities) {+ if (e.kind === 'function') expect(e.packageScope).toBe('bar');+ }+ });++ it('resolves method-call qualifier to parameter type so opts.Run becomes Options.Run', () => {+ const result = parseFile(+ '/repo/svc.go',+ `+package svc++type Options struct{}+func (o *Options) Run() {}++type Scheme struct{}+func (s *Scheme) Register() {}++// Parameter type substitution+func handle(opts *Options) {+ opts.Run()+}++// Receiver type substitution+func (s *Scheme) start(opts *Options) {+ s.Register()+ opts.Run()+}+ `,+ );++ expect(result).not.toBeNull();+ const rels = result!.relationships;++ // Parameter substitution: opts is typed *Options, so opts.Run → Options.Run+ expect(rels).toContainEqual({+ srcName: 'handle',+ dstName: 'Options.Run',+ predicate: 'CALLS',+ });++ // Receiver substitution: s is typed *Scheme, so s.Register → Scheme.Register.+ // Caller srcName for a method is the container-qualified form ("Scheme.start").+ expect(rels).toContainEqual({+ srcName: 'Scheme.start',+ dstName: 'Scheme.Register',+ predicate: 'CALLS',+ });++ // Other param within the same method still resolves+ expect(rels).toContainEqual({+ srcName: 'Scheme.start',+ dstName: 'Options.Run',+ predicate: 'CALLS',+ });+ });++ it('captures REFERENCES from type assertions, type switches, var declarations, and qualified composite literals', () => {+ const result = parseFile(+ '/repo/refs.go',+ `+package refs++import "io"++type Closer interface { Close() error }++func use(x any) {+ // Type assertion+ if c, ok := x.(Closer); ok { _ = c }+ // Type switch+ switch v := x.(type) {+ case Closer: _ = v+ case *Buffer: _ = v+ case io.Reader: _ = v+ }+}++// Var declarations+var globalBuf Buffer+var globalReader io.Reader+var globalSlice []Item++func init() {+ // Composite literal with qualified type+ _ = &io.LimitedReader{R: nil}+}+ `,+ );++ expect(result).not.toBeNull();+ const rels = result!.relationships;++ // Type assertion REFERENCES+ expect(rels).toContainEqual({ srcName: 'use', dstName: 'Closer', predicate: 'REFERENCES' });++ // Type switch case REFERENCES+ expect(rels).toContainEqual({ srcName: 'use', dstName: 'Buffer', predicate: 'REFERENCES' });+ expect(rels).toContainEqual({ srcName: 'use', dstName: 'Reader', predicate: 'REFERENCES' });++ // Var-declaration REFERENCES (caller resolves to file since they're file-scope)+ const refsTo = (name: string) => rels.filter(r => r.predicate === 'REFERENCES' && r.dstName === name);+ expect(refsTo('Buffer').length).toBeGreaterThanOrEqual(1);+ expect(refsTo('Reader').length).toBeGreaterThanOrEqual(1);+ expect(refsTo('Item').length).toBeGreaterThanOrEqual(1);++ // Composite literal with qualified type+ expect(refsTo('LimitedReader').length).toBeGreaterThanOrEqual(1);+ });++ it('captures CALLS where the receiver operand is not an identifier or selector chain', () => {+ // Real-world Go uses many receiver shapes that aren't bare identifiers or+ // dotted chains. Each block below produces a method call whose function:+ // selector_expression has a non-(identifier|selector_expression) operand.+ const result = parseFile(+ '/repo/shapes.go',+ `+package shapes++type Item struct{}+func (it *Item) Run() {}+func (it *Item) Step() {}++type Fooer interface { Foo() }++func factory() *Item { return nil }++func callsViaCall() { factory().Run() }+func callsViaIndex(xs []*Item) { xs[0].Run() }+func callsViaSlice(xs []*Item) { xs[1:][0].Run() }+func callsViaTypeAssert(x any) { x.(Fooer).Foo() }+func callsViaParens(it *Item) { (it).Run() }+func callsViaDeref(p **Item) { (*p).Run() }+ `,+ );++ expect(result).not.toBeNull();+ for (const caller of [+ 'callsViaCall',+ 'callsViaIndex',+ 'callsViaSlice',+ 'callsViaTypeAssert',+ 'callsViaParens',+ 'callsViaDeref',+ ]) {+ const dst = caller === 'callsViaTypeAssert' ? 'Foo' : 'Run';+ expect(result!.relationships).toContainEqual({+ srcName: caller,+ dstName: dst,+ predicate: 'CALLS',+ });+ }+ });});diff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.tsindex d2f3852d..c52644dd 100644--- a/core-ingestion/src/index.ts+++ b/core-ingestion/src/index.ts@@ -51,6 +51,15 @@ export interface ParsedEntity {language: string;/** Direct enclosing class/interface/trait, if any (undefined for file-level entities). */container?: string;+ /**+ * Package name for languages that group entities into namespaces (currently+ * Go only). Used by downstream layers to prefix qualifiedName so the symbol+ * table indexes entities under their fully-qualified path. Without this,+ * bare-name resolution at edge-resolver collides between packages (e.g.+ * kubernetes has 191 distinct `addKnownTypes` functions, one per API group)+ * and CALL targets are picked non-deterministically.+ */+ packageScope?: string;}/** A semantic code span extracted from the AST. The primary LLM retrieval unit. */@@ -1241,7 +1250,8 @@ export function parseFile(filePath: string, source: string): FileParseResult | nfor (const c of m.captures) {const n = c.name;if (n.startsWith('definition.') || n.startsWith('heritage.') ||- n === '_typed_param_scope' || n === '_assign_scope' || n === '_typed_var_scope') {+ n === '_typed_param_scope' || n === '_assign_scope' || n === '_typed_var_scope' ||+ n === '_go_param_scope') {isPass1 = true;break;}@@ -1283,6 +1293,18 @@ export function parseFile(filePath: string, source: string): FileParseResult | n// Import aliases keyed by the in-file alias name (Go explicit aliases, etc.).const importAliases: Record<string, string> = {};+ // Detect the Go package name once (one package_clause per file). Used to+ // package-prefix Go entity qualifiedNames + bare-call dstNames so+ // resolution is deterministic across same-named entities in different+ // packages.+ let goPackage: string | undefined;+ if (language === SupportedLanguages.Go) {+ for (const m of [...pass1Matches, ...pass2Matches]) {+ const cap = m.captures.find((c: any) => c.name === 'package.name');+ if (cap) { goPackage = cap.node.text; break; }+ }+ }+// --- First pass: collect definitions ---for (const match of pass1Matches) {// Definition captures: name + definition.*@@ -1325,6 +1347,7 @@ export function parseFile(filePath: string, source: string): FileParseResult | nlineEnd,language,container: effectiveContainer,+ packageScope: goPackage,});pendingChunks.push({@@ -1415,6 +1438,46 @@ export function parseFile(filePath: string, source: string): FileParseResult | n}}+ // Go typed parameters: build paramTypeMap so method calls on+ // parameters (incl. receivers) resolve to the parameter's declared+ // type. e.g. `func (s *Scheme) F(opts *Options) { opts.Run() }`+ // records s → Scheme, opts → Options so `opts.Run()` becomes+ // `Options.Run` instead of bare `Run` (which is ambiguous across+ // 100+ same-named methods in a large monorepo).+ //+ // For method_declarations, the paramTypeMap key MUST include the+ // receiver type (i.e. `Container.method`) because that's what+ // findEnclosingFunction returns at call-resolution time. Without+ // this, lookups for callers inside methods miss.+ if (language === SupportedLanguages.Go) {+ const goParamScope = match.captures.find((c: any) => c.name === '_go_param_scope');+ const goParamName = match.captures.find((c: any) => c.name === '_go_param_name');+ const goParamType = match.captures.find((c: any) => c.name === '_go_param_type');+ if (goParamScope && goParamName && goParamType) {+ const scopeNode = goParamScope.node;+ const baseName = scopeNode.childForFieldName?.('name')?.text as string | undefined;+ if (baseName) {+ let key = baseName;+ if (scopeNode.type === 'method_declaration') {+ const recvList = scopeNode.childForFieldName('receiver');+ const recvDecl = recvList?.firstNamedChild;+ const recvType = recvDecl?.childForFieldName('type');+ let container: string | undefined;+ if (recvType?.type === 'type_identifier') {+ container = recvType.text;+ } else if (recvType?.type === 'pointer_type') {+ const inner = recvType.firstNamedChild;+ if (inner?.type === 'type_identifier') container = inner.text;+ }+ if (container) key = `${container}.${baseName}`;+ }+ if (!paramTypeMap.has(key)) paramTypeMap.set(key, new Map());+ paramTypeMap.get(key)!.set(goParamName.node.text, goParamType.node.text);+ }+ continue;+ }+ }+// C/C++ typed declarations: capture local vars, parameters, and fields so that// member calls like current->Get(...) can be rewritten to Version.Get.if (language === SupportedLanguages.C || language === SupportedLanguages.CPlusPlus) {@@ -1538,6 +1601,19 @@ export function parseFile(filePath: string, source: string): FileParseResult | nconst effectiveCallee = (() => {if (!qualifierCapture) {+ // Go: bare-function calls (call.name is an `identifier` — i.e.+ // pattern 1: `Foo()`) resolve to the caller's package, so prepend+ // the package name for deterministic resolution. Method-shaped+ // calls captured by the catch-all (call.name is a+ // `field_identifier` — i.e. `recv.X.Method()`) dispatch on the+ // receiver's type, NOT the caller's package, so leave them bare.+ if (+ language === SupportedLanguages.Go &&+ goPackage &&+ callName.node.type === 'identifier'+ ) {+ return `${goPackage}.${callee}`;+ }// Python: if the callee is a local alias for a class, substitute the class name.// e.g. engineclass = base.Engine; engineclass(pool, ...) → Engine(pool, ...)if (language === SupportedLanguages.Python) {@@ -1572,6 +1648,17 @@ export function parseFile(filePath: string, source: string): FileParseResult | nif (typeForParam) qualifier = typeForParam;else if (typeForAssign) qualifier = typeForAssign;}+ } else if (language === SupportedLanguages.Go) {+ // Go: if the qualifier matches a tracked parameter/receiver in the+ // enclosing function, substitute with the parameter's declared+ // type. e.g. `opts.Run()` inside `func F(opts *Options)` → use+ // qualifier "Options" so dstName is "Options.Run", which+ // edge-resolver indexes via the container.name fallback key.+ const funcName = findEnclosingFunction(entities, callLine);+ if (funcName) {+ const typeForParam = paramTypeMap.get(funcName)?.get(qualifier);+ if (typeForParam) qualifier = typeForParam;+ }} else if (language === SupportedLanguages.C || language === SupportedLanguages.CPlusPlus) {const funcName = findEnclosingFunction(entities, callLine) ?? fileName;const className = findEnclosing(classRanges, callLine, '')@@ -1648,7 +1735,8 @@ export function parseFile(filePath: string, source: string): FileParseResult | nimportAliases: Object.keys(importAliases).length > 0 ? importAliases : undefined,fileRole: classifyFileRole(filePath, source),};- } catch {+ } catch (e) {+ if (process.env.IX_PARSE_DEBUG === '1') console.error('parseFile threw:', e);return null;}}diff --git a/core-ingestion/src/queries.ts b/core-ingestion/src/queries.tsindex 979651ff..08793275 100644--- a/core-ingestion/src/queries.ts+++ b/core-ingestion/src/queries.ts@@ -423,6 +423,12 @@ export const C_QUERIES = `// Go queries - works with tree-sitter-goexport const GO_QUERIES = `+; Package declaration — captures the package name so the parser can+; prefix every Go entity's qualifiedName with it, eliminating the bare-name+; collision problem that makes call resolution non-deterministic when+; multiple packages define a function with the same name.+(package_clause (package_identifier) @package.name)+; Functions(function_declaration name: (identifier) @name) @definition.function@@ -484,6 +490,39 @@ export const GO_QUERIES = `(field_declaration .(pointer_type (type_identifier) @heritage.extends) .)))))+; Struct embedding — qualified type: type Foo struct { pkg.Bar }+(type_declaration+ (type_spec+ name: (type_identifier) @heritage.class+ type: (struct_type+ (field_declaration_list+ (field_declaration .+ (qualified_type name: (type_identifier) @heritage.extends) .)))))++; Struct embedding — pointer-to-qualified: type Foo struct { *pkg.Bar }+(type_declaration+ (type_spec+ name: (type_identifier) @heritage.class+ type: (struct_type+ (field_declaration_list+ (field_declaration .+ (pointer_type (qualified_type name: (type_identifier) @heritage.extends)) .)))))++; Interface embedding — bare: type Reader interface { Closer }+; Embedded interfaces are wrapped in type_elem in tree-sitter-go's grammar.+(type_declaration+ (type_spec+ name: (type_identifier) @heritage.class+ type: (interface_type+ (type_elem (type_identifier) @heritage.extends))))++; Interface embedding — qualified: type Reader interface { io.Reader }+(type_declaration+ (type_spec+ name: (type_identifier) @heritage.class+ type: (interface_type+ (type_elem (qualified_type name: (type_identifier) @heritage.extends)))))+; Calls(call_expression function: (identifier) @call.name) @call; Qualified calls: pkg.Func() or localVar.Method() where the operand is a simple@@ -493,27 +532,206 @@ export const GO_QUERIES = `(call_expression function: (selector_expressionoperand: (identifier) @_qualifierfield: (field_identifier) @call.name)) @call-; Chained/complex calls: a.b.Method(), call().Method(), index[i].Method() — the-; operand is not a simple identifier, so emit without qualifier (bare method name).+; All other method-call shapes — chained off function call, indexed,+; type-asserted, parenthesized, dereferenced, sliced, etc. We omit the+; operand field constraint so this matches any subtree. The bare method+; name (field_identifier) is captured; no @_qualifier means cross-file+; resolution falls back to method-name-only matching for these calls.(call_expression function: (selector_expression- operand: (selector_expression)field: (field_identifier) @call.name)) @call; Struct literal construction: User{Name: "Alice"}(composite_literal type: (type_identifier) @call.name) @call-; Type references — captures types used in field/param/return-type positions+; ── Type references ─────────────────────────────────────────────────+; Captures types used in field, parameter, variadic, and result positions.+; The bare patterns below catch the common case (Item param / Item return),+; but Go signatures lean heavily on pointer, slice, map, channel,+; qualified-type, and variadic shapes — each needs its own pattern in+; tree-sitter's structural query language.++; --- Bare type_identifier ---(field_declaration type: (type_identifier) @reference.type)(parameter_declaration type: (type_identifier) @reference.type)-; Return types: in tree-sitter-go, return type is a direct type_identifier child of function/method(function_declaration result: (type_identifier) @reference.type)(method_declaration result: (type_identifier) @reference.type)+(variadic_parameter_declaration type: (type_identifier) @reference.type)-; Pointer-type variants: e.g. opts *Options, func(*Options) *Result+; --- Pointer types ---(field_declaration type: (pointer_type (type_identifier) @reference.type))(parameter_declaration type: (pointer_type (type_identifier) @reference.type))(function_declaration result: (pointer_type (type_identifier) @reference.type))(method_declaration result: (pointer_type (type_identifier) @reference.type))+(variadic_parameter_declaration type: (pointer_type (type_identifier) @reference.type))++; --- Qualified types: pkg.Type (capture the bare type_identifier "Type")+(field_declaration type: (qualified_type name: (type_identifier) @reference.type))+(parameter_declaration type: (qualified_type name: (type_identifier) @reference.type))+(function_declaration result: (qualified_type name: (type_identifier) @reference.type))+(method_declaration result: (qualified_type name: (type_identifier) @reference.type))+(variadic_parameter_declaration type: (qualified_type name: (type_identifier) @reference.type))++; --- Pointer-to-qualified: *pkg.Type ---+(field_declaration type: (pointer_type (qualified_type name: (type_identifier) @reference.type)))+(parameter_declaration type: (pointer_type (qualified_type name: (type_identifier) @reference.type)))+(function_declaration result: (pointer_type (qualified_type name: (type_identifier) @reference.type)))+(method_declaration result: (pointer_type (qualified_type name: (type_identifier) @reference.type)))++; --- Slice types: []Item / []*Item / []pkg.Item ---+(field_declaration type: (slice_type element: (type_identifier) @reference.type))+(field_declaration type: (slice_type element: (pointer_type (type_identifier) @reference.type)))+(field_declaration type: (slice_type element: (qualified_type name: (type_identifier) @reference.type)))+(parameter_declaration type: (slice_type element: (type_identifier) @reference.type))+(parameter_declaration type: (slice_type element: (pointer_type (type_identifier) @reference.type)))+(parameter_declaration type: (slice_type element: (qualified_type name: (type_identifier) @reference.type)))+(function_declaration result: (slice_type element: (type_identifier) @reference.type))+(function_declaration result: (slice_type element: (pointer_type (type_identifier) @reference.type)))+(method_declaration result: (slice_type element: (type_identifier) @reference.type))+(method_declaration result: (slice_type element: (pointer_type (type_identifier) @reference.type)))++; --- Map types: map[K]V (capture both K and V type_identifiers) ---+(field_declaration type: (map_type key: (type_identifier) @reference.type))+(field_declaration type: (map_type value: (type_identifier) @reference.type))+(field_declaration type: (map_type value: (pointer_type (type_identifier) @reference.type)))+(field_declaration type: (map_type value: (qualified_type name: (type_identifier) @reference.type)))+(parameter_declaration type: (map_type key: (type_identifier) @reference.type))+(parameter_declaration type: (map_type value: (type_identifier) @reference.type))+(parameter_declaration type: (map_type value: (pointer_type (type_identifier) @reference.type)))+(parameter_declaration type: (map_type value: (qualified_type name: (type_identifier) @reference.type)))++; --- Channel types: chan Item ---+(field_declaration type: (channel_type value: (type_identifier) @reference.type))+(parameter_declaration type: (channel_type value: (type_identifier) @reference.type))++; --- Type assertions: x.(SomeType), x.(*pkg.SomeType) ---+(type_assertion_expression type: (type_identifier) @reference.type)+(type_assertion_expression type: (pointer_type (type_identifier) @reference.type))+(type_assertion_expression type: (qualified_type name: (type_identifier) @reference.type))+(type_assertion_expression type: (pointer_type (qualified_type name: (type_identifier) @reference.type)))++; --- Type switch cases: case Foo, *Bar, pkg.Baz: ... ---+(type_case type: (type_identifier) @reference.type)+(type_case type: (pointer_type (type_identifier) @reference.type))+(type_case type: (qualified_type name: (type_identifier) @reference.type))+(type_case type: (pointer_type (qualified_type name: (type_identifier) @reference.type)))++; --- Var declarations with explicit type: var x SomeType ---+(var_spec type: (type_identifier) @reference.type)+(var_spec type: (pointer_type (type_identifier) @reference.type))+(var_spec type: (qualified_type name: (type_identifier) @reference.type))+(var_spec type: (pointer_type (qualified_type name: (type_identifier) @reference.type)))+(var_spec type: (slice_type element: (type_identifier) @reference.type))+(var_spec type: (slice_type element: (pointer_type (type_identifier) @reference.type)))+(var_spec type: (slice_type element: (qualified_type name: (type_identifier) @reference.type)))+(var_spec type: (map_type key: (type_identifier) @reference.type))+(var_spec type: (map_type value: (type_identifier) @reference.type))+(var_spec type: (map_type value: (qualified_type name: (type_identifier) @reference.type)))+(var_spec type: (channel_type value: (type_identifier) @reference.type))++; --- Const declarations with explicit type: const x SomeType = 0 ---+(const_spec type: (type_identifier) @reference.type)+(const_spec type: (qualified_type name: (type_identifier) @reference.type))++; --- Composite literals with qualified type: &pkg.User{...}+; (bare-type composite literals already captured as @call.name above —+; that emits a CALLS edge to the type name, which the resolver treats as+; a constructor-like call. The pattern below covers the qualified form+; that the bare composite_literal pattern doesn't match.)+(composite_literal type: (qualified_type name: (type_identifier) @reference.type))+(composite_literal type: (slice_type element: (type_identifier) @reference.type))+(composite_literal type: (slice_type element: (qualified_type name: (type_identifier) @reference.type)))+(composite_literal type: (map_type value: (type_identifier) @reference.type))+(composite_literal type: (map_type value: (qualified_type name: (type_identifier) @reference.type)))+(composite_literal type: (array_type element: (type_identifier) @reference.type))++; --- Array types in field/parameter/result/var positions: [N]Item ---+(field_declaration type: (array_type element: (type_identifier) @reference.type))+(field_declaration type: (array_type element: (qualified_type name: (type_identifier) @reference.type)))+(parameter_declaration type: (array_type element: (type_identifier) @reference.type))+(parameter_declaration type: (array_type element: (qualified_type name: (type_identifier) @reference.type)))+(function_declaration result: (array_type element: (type_identifier) @reference.type))+(method_declaration result: (array_type element: (type_identifier) @reference.type))+(var_spec type: (array_type element: (type_identifier) @reference.type))++; --- Generic type constraints: func F[T Ord](...) ---+; T is the type-parameter name, Ord is the constraint (a real type reference).+; type_constraint contains _type children directly (not wrapped in type_elem).+(type_parameter_declaration type: (type_constraint (type_identifier) @reference.type))+(type_parameter_declaration type: (type_constraint (qualified_type name: (type_identifier) @reference.type)))++; --- Type instantiation expressions: Container[Item], Pick[int]+; (rhs of short var decls, function arguments, parametric type uses)+(type_instantiation_expression type: (type_identifier) @reference.type)+(type_instantiation_expression type: (qualified_type name: (type_identifier) @reference.type))++; ── Go method-call receiver-type inference ──────────────────────────+; Track each parameter's declared type so method calls on that parameter+; can be rewritten from "x.Method" to "Type.Method" — eliminating the+; bare-name ambiguity that drops or misroutes 15-25% of CALL edges.+; Mirrors the Python typed-parameter mechanism (_typed_param_scope etc.).++; Function parameter — bare type: func F(x Item) {...}+(function_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (type_identifier) @_go_param_type))) @_go_param_scope++; Function parameter — pointer type: func F(x *Item) {...}+(function_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (pointer_type (type_identifier) @_go_param_type)))) @_go_param_scope++; Function parameter — qualified type: func F(x pkg.Item) {...}+(function_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (qualified_type name: (type_identifier) @_go_param_type)))) @_go_param_scope++; Function parameter — pointer-qualified: func F(x *pkg.Item) {...}+(function_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (pointer_type (qualified_type name: (type_identifier) @_go_param_type))))) @_go_param_scope++; Method parameter — bare type+(method_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (type_identifier) @_go_param_type))) @_go_param_scope++; Method parameter — pointer type+(method_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (pointer_type (type_identifier) @_go_param_type)))) @_go_param_scope++; Method parameter — qualified type+(method_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (qualified_type name: (type_identifier) @_go_param_type)))) @_go_param_scope++; Method parameter — pointer-qualified+(method_declaration+ parameters: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (pointer_type (qualified_type name: (type_identifier) @_go_param_type))))) @_go_param_scope++; Method receiver — bare type: func (r Recv) M() {...} → r → Recv+(method_declaration+ receiver: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (type_identifier) @_go_param_type))) @_go_param_scope++; Method receiver — pointer type: func (r *Recv) M() {...}+(method_declaration+ receiver: (parameter_list (parameter_declaration+ name: (identifier) @_go_param_name+ type: (pointer_type (type_identifier) @_go_param_type)))) @_go_param_scope+(parameter_declaration type: (pointer_type (type_identifier) @reference.type))+(function_declaration result: (pointer_type (type_identifier) @reference.type))+(method_declaration result: (pointer_type (type_identifier) @reference.type)); Imported/package-qualified type refs: *scheduler.Scheduler, scheduler.Scheduler(field_declaration type: (qualified_type (type_identifier) @reference.type))(parameter_declaration type: (qualified_type (type_identifier) @reference.type))