Skip to content

Commit

Permalink
fixes a converter handling regression that caused private converters …
Browse files Browse the repository at this point in the history
…to leak into client modules; fixes #19213; [backport:1.6]
  • Loading branch information
Araq committed Dec 9, 2021
1 parent 93c8427 commit 2d21564
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/importer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ template addUnnamedIt(c: PContext, fromMod: PSym; filter: untyped) {.dirty.} =
for it in mitems c.graph.ifaces[fromMod.position].converters:
if filter:
loadPackedSym(c.graph, it)
addConverter(c, it)
if sfExported in it.sym.flags:
addConverter(c, it)
for it in mitems c.graph.ifaces[fromMod.position].patterns:
if filter:
loadPackedSym(c.graph, it)
addPattern(c, it)
if sfExported in it.sym.flags:
addPattern(c, it)
for it in mitems c.graph.ifaces[fromMod.position].pureEnums:
if filter:
loadPackedSym(c.graph, it)
Expand Down
3 changes: 3 additions & 0 deletions tests/converter/mdontleak.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

converter toBool(x: uint32): bool = x != 0
# Note: This convertes is not exported!
10 changes: 10 additions & 0 deletions tests/converter/tdontleak.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
discard """
output: '''5'''
joinable: false
"""

import mdontleak
# bug #19213

let a = 5'u32
echo a

0 comments on commit 2d21564

Please sign in to comment.