From 98c29c01eb91a0c6ce7da09380a272eebe6bca6f Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 7 May 2021 10:36:41 -0700 Subject: fix #14873 properly by skipping `abi` field in importc type (#17944) * fix #14873 properly by skipping `abi` field in importc type * add test * fix test for windows --- tests/stdlib/uselocks.nim | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/stdlib/uselocks.nim b/tests/stdlib/uselocks.nim index e9d23f9d9..e82de8adf 100644 --- a/tests/stdlib/uselocks.nim +++ b/tests/stdlib/uselocks.nim @@ -11,5 +11,21 @@ proc use* (m: var MyType): int = result = 3 block: + # bug #14873 var l: Lock - doAssert $l == "()" + doAssert ($l).len > 0 + # on posix, "()", on windows, something else, but that shouldn't be part of the spec + # what matters is that `$` doesn't cause the codegen bug mentioned + +when true: # intentional + # bug https://github.com/nim-lang/Nim/issues/14873#issuecomment-784241605 + type + Test = object + path: string # Removing this makes both cases work. + lock: Lock + # A: This is not fine. + var a = Test() + proc main(): void = + # B: This is fine. + var b = Test() + main() -- cgit 1.4.1-2-gfad0