You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
use Sema from Lsp.w causes cascading false TypeId type errors #57
Adding use Sema to src/Lsp.w causes 54 spurious "type mismatch" errors in Sema.w and SemaCheck.w, even though 22 other files already import Sema without issue.
Reproduction
Add use Sema to src/Lsp.w imports:
use Sema
use Compilation
Then make build produces errors like:
error: type mismatch in assignment
src/Sema.w:587:5
587 | s.ty_i8 = s.add_type(TypeKind.TY_INT, 8, 1, 0)
error: type mismatch in assignment
src/SemaCheck.w:280:9
280 | self.current_gen_yield_type = ret_type as TypeId
These are all TypeId (distinct i32) vs i32 mismatches. The same code compiles without errors when only the existing 22 files import Sema.
Expected
Adding another use Sema consumer should not cause type errors in unrelated files. The TypeId = distinct i32 type should be resolved consistently regardless of which files import the module.
Root Cause (suspected)
The module import merging changes declaration processing order when a new importer is added. The seed compiler's distinct type resolution is order-sensitive, causing false conflicts when the same module is imported from a different position in the dependency graph.
Workaround
Access sema data indirectly through comp.zcu.last_sema field access, and add helper methods to Sema.w that Lsp.w calls through the Zcu, avoiding a direct use Sema import.
Activity
Fix module-aware type lookup regressions