From d71fd1688b4dd093392064d18ee9ad52eaafc3be Mon Sep 17 00:00:00 2001 From: evolution Date: Fri, 29 May 2026 13:46:02 +0800 Subject: [PATCH] feat(go): add builtInNames set to Go language provider (#1886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(go): add builtInNames set to Go language provider Add GO_BUILT_INS (15 functions, 18 types, 3 values) to the Go LanguageProvider for parity with the other 13 language providers. The set is converted to an isBuiltInName predicate by defineLanguage() and consumed by the type-env return-type lookup to short-circuit lookups for Go built-in symbols. * feat(go): add Go 1.18+ and 1.21 predeclared identifiers to builtInNames Add `clear`, `min`, `max` (Go 1.21 builtins), `any`, `comparable` (Go 1.18 type aliases), and `iota` (predeclared constant) to GO_BUILT_INS for complete coverage of the Go specification. --------- Co-authored-by: Gergő Magyar --- gitnexus/src/core/ingestion/languages/go.ts | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/gitnexus/src/core/ingestion/languages/go.ts b/gitnexus/src/core/ingestion/languages/go.ts index 5c9aef039..b1f8f8ce5 100644 --- a/gitnexus/src/core/ingestion/languages/go.ts +++ b/gitnexus/src/core/ingestion/languages/go.ts @@ -39,6 +39,56 @@ import { interpretGoTypeBinding, } from './go/index.js'; +const GO_BUILT_INS: ReadonlySet = new Set([ + // built-in functions + 'make', + 'new', + 'len', + 'cap', + 'append', + 'copy', + 'delete', + 'close', + 'panic', + 'recover', + 'print', + 'println', + 'complex', + 'real', + 'imag', + 'clear', + 'min', + 'max', + // built-in types + 'error', + 'bool', + 'string', + 'int', + 'int8', + 'int16', + 'int32', + 'int64', + 'uint', + 'uint8', + 'uint16', + 'uint32', + 'uint64', + 'uintptr', + 'float32', + 'float64', + 'complex64', + 'complex128', + 'byte', + 'rune', + 'any', + 'comparable', + // built-in values + 'true', + 'false', + 'nil', + 'iota', +]); + export const goProvider = defineLanguage({ id: SupportedLanguages.Go, extensions: ['.go'], @@ -92,6 +142,7 @@ export const goProvider = defineLanguage({ variableExtractor: createVariableExtractor(goVariableConfig), classExtractor: createClassExtractor(goClassConfig), heritageExtractor: createHeritageExtractor(goHeritageConfig), + builtInNames: GO_BUILT_INS, // ── RFC #909 Ring 3: scope-based resolution hooks ────────── emitScopeCaptures: emitGoScopeCaptures,