Skip to content

fix: resolve generics across modules in the declaring module - #1396

Merged
kacy merged 6 commits into
mainfrom
fix/generic-cross-module
Nov 14, 2026
Merged

kacy merged 6 commits into
mainfrom
fix/generic-cross-module

Conversation

@kacy

@kacy kacy commented Nov 14, 2026

Copy link
Copy Markdown
Owner

A generic body specialized in another module used the instantiating module's names. Its imports were the caller's, so a call from it into a third module's generic did not resolve, and a generic signature naming its own module's type picked up a same-named type in the caller. The emitter now uses the declaring module's imports while it emits a specialization, and the driver gives each module's emission the imports of the generic modules it depends on. The checker now types a generic call's signature in the declaring module.

A generic and a plain struct with one name in two modules are now kept apart. The pair is treated like two same-named generics, a module's own plain type shadows a foreign generic, and a generic impl no longer takes the plain struct's type id. Two modules that declare the same generic enum now compile, and each module's constructors and matches use its own declaration.

The std/algo workaround for the cross-module call is gone. Regression cases cover each shape, and docs/limitations.md drops the fixed entries.

Closes #1095

@kacy kacy closed this Nov 14, 2026
@kacy
kacy deleted the fix/generic-cross-module branch November 14, 2026 22:35
@kacy
kacy restored the fix/generic-cross-module branch November 14, 2026 22:35
@kacy kacy reopened this Nov 14, 2026
@kacy
kacy merged commit 1317e5c into main Nov 14, 2026
4 checks passed
@kacy
kacy deleted the fix/generic-cross-module branch November 14, 2026 22:36
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.

calling a generic function in another module from inside a generic body fails to resolve

1 participant