diff --git a/compiler/ast2nif.nim b/compiler/ast2nif.nim index 48771d10e1..f815d64eec 100644 --- a/compiler/ast2nif.nim +++ b/compiler/ast2nif.nim @@ -307,11 +307,18 @@ proc writeSymDef(w: var Writer; dest: var TokenBuf; sym: PSym) = w.writtenSyms.add sym proc shouldWriteSymDef(w: Writer; sym: PSym): bool {.inline.} = + # Don't write module/package symbols - they don't have NIF files + if sym.kindImpl in {skModule, skPackage}: + return false result = sym.itemId.module == w.currentModule and sym.state == Complete proc writeSym(w: var Writer; dest: var TokenBuf; sym: PSym) = if sym == nil: dest.addDotToken() + elif sym.kindImpl in {skModule, skPackage}: + # Write module/package symbols as dots - they're resolved differently + # (by position/FileIndex, not by NIF lookup) + dest.addDotToken() elif shouldWriteSymDef(w, sym): sym.state = Sealed writeSymDef(w, dest, sym)