mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
fixes a converter handling regression that caused private converters to leak into client modules; fixes #19213; [backport:1.6] (#19229)
(cherry picked from commit 502ac4ed5e)
This commit is contained in:
@@ -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)
|
||||
|
||||
3
tests/converter/mdontleak.nim
Normal file
3
tests/converter/mdontleak.nim
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
converter toBool(x: uint32): bool = x != 0
|
||||
# Note: This convertes is not exported!
|
||||
10
tests/converter/tdontleak.nim
Normal file
10
tests/converter/tdontleak.nim
Normal file
@@ -0,0 +1,10 @@
|
||||
discard """
|
||||
output: '''5'''
|
||||
joinable: false
|
||||
"""
|
||||
|
||||
import mdontleak
|
||||
# bug #19213
|
||||
|
||||
let a = 5'u32
|
||||
echo a
|
||||
Reference in New Issue
Block a user