Skip to content

fix: Quit panicking on named types over error#258

Merged
jupblb merged 1 commit into
scip-code:mainfrom
prathshenoy:fix/named-types-over-error
May 18, 2026
Merged

fix: Quit panicking on named types over error#258
jupblb merged 1 commit into
scip-code:mainfrom
prathshenoy:fix/named-types-over-error

Conversation

@prathshenoy
Copy link
Copy Markdown
Contributor

A panic breaks indexing for any module whose package graph contains a defined type whose underlying type is the built-in error interface e.g., type CustomErr error. The crash fires during implementation-relationship extraction.

When scip-go walks a dependency's exported types and computes their method sets, the inherited Error method on a user-defined wrapper over error surfaces as a function whose enclosing package is nil but whose receiver has been rebound to the user-defined name CustomErr. The guard in GetSymbolOfObject recognized only the literal universe receiver, so the rebound form fell through to an unconditional panic.

This change unconditionally skips any function with a nil enclosing package during symbol lookup. The only such functions today are methods inherited from universe-block interfaces, which scip-go does not emit symbols for in any case, matching its existing behavior for direct Error calls on plain error-typed values.

Copy link
Copy Markdown
Collaborator

@jupblb jupblb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 😃

@jupblb jupblb merged commit 3c10120 into scip-code:main May 18, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants