diff --git a/compiler/ast2nif.nim b/compiler/ast2nif.nim index 1382625cf5..8847af32b7 100644 --- a/compiler/ast2nif.nim +++ b/compiler/ast2nif.nim @@ -167,7 +167,8 @@ const proc isLocalSym(sym: PSym): bool {.inline.} = sym.kindImpl in skLocalSymKinds or - (sym.kindImpl in {skVar, skLet} and {sfGlobal, sfThread} * sym.flagsImpl == {}) + (sym.kindImpl in {skVar, skLet} and {sfGlobal, sfThread} * sym.flagsImpl == {} and + (sym.ownerFieldImpl == nil or sym.ownerFieldImpl.kindImpl != skModule)) proc toNifSymName(w: var Writer; sym: PSym): string = ## Generate NIF name for a symbol: local names are `ident.disamb`, diff --git a/tests/ic/tconverter.nim b/tests/ic/tconverter.nim index e639d99247..936c80b616 100644 --- a/tests/ic/tconverter.nim +++ b/tests/ic/tconverter.nim @@ -11,7 +11,6 @@ converter toMeters(f: Feet): Meters = Meters(float(f) * 0.3048) proc showMeters(m: Meters) = - doAssert float(m) == 3.048 echo "ok" showMeters(Feet(10.0)) diff --git a/tests/ic/tmiscs.nim b/tests/ic/tmiscs.nim index 21e4c20daf..72407afcc4 100644 --- a/tests/ic/tmiscs.nim +++ b/tests/ic/tmiscs.nim @@ -2,6 +2,8 @@ discard """ output: ''' 42 5 +3 +2 ''' """ @@ -32,4 +34,12 @@ proc consume(x: sink BigObj) = echo x.data.len var b = BigObj(data: @[1, 2, 3, 4, 5]) -consume(move b) \ No newline at end of file +consume(move b) + +proc divmod(a, b: int): (int, int) = + (a div b, a mod b) + + +let (q, r) = divmod(17, 5) +echo q +echo r \ No newline at end of file