From 8d4866160ef91084ea13b526694e56ce9c805dd2 Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Mon, 11 May 2020 16:49:44 -0500 Subject: Fix #196 - allow remapping of types --- tests/include/tast2.h | 12 ++++++++++++ tests/tast2.nim | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/include/tast2.h b/tests/include/tast2.h index 878a3a2..bbb3315 100644 --- a/tests/include/tast2.h +++ b/tests/include/tast2.h @@ -243,6 +243,12 @@ static inline int sitest1(int f1) { return f1 * 2; } +// Issue #196 +typedef int MyInt; +struct TestMyInt { + MyInt f1; +}; + // DUPLICATES @@ -439,6 +445,12 @@ static inline int sitest1(int f1) { return f1 * 2; } +// Issue #196 +typedef int MyInt; +struct TestMyInt { + MyInt f1; +}; + #endif diff --git a/tests/tast2.nim b/tests/tast2.nim index bd040e2..4fd16cc 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -35,7 +35,7 @@ cOverride: type A1* = A0 -cImport(path, flags="-f:ast2 -ENK_,SDL_ -GVICE=SLICE" & flags) +cImport(path, flags="-f:ast2 -ENK_,SDL_ -GVICE=SLICE -TMyInt=cint" & flags) proc getPragmas(n: NimNode): HashSet[string] = # Find all pragmas in AST, return as "name" or "name:value" in set @@ -478,3 +478,8 @@ checkPragmas(nested, pHeaderImpBy) when not defined(NOHEADER): assert sitest1(5) == 10 assert sitest1(10) == 20 + +when declared(MyInt): + assert false, "MyInt is defined!" +testFields(TestMyInt, "f1!cint") +checkPragmas(TestMyInt, pHeaderBy, isType = false) \ No newline at end of file -- cgit v1.2.3