diff options
Diffstat (limited to 'tests/generics/tforwardgeneric.nim')
-rw-r--r-- | tests/generics/tforwardgeneric.nim | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/generics/tforwardgeneric.nim b/tests/generics/tforwardgeneric.nim index af0c7daf4..9f68bf332 100644 --- a/tests/generics/tforwardgeneric.nim +++ b/tests/generics/tforwardgeneric.nim @@ -1,7 +1,6 @@ discard """ - output: "1.1000000000000001e+00 11" + output: "1.1 11\n42\n0" ccodecheck: "!@'ClEnv'" - disabled: "true" """ proc p[T](a, b: T): T @@ -12,3 +11,18 @@ proc p[T](a, b: T): T = let c = b result = a + b + c +# https://github.com/nim-lang/Nim/issues/4908 +proc foo(t: typedesc[int]): int +proc bar(): int = foo(int) +proc foo(t: typedesc[int]): int = + return 0 + +# https://github.com/nim-lang/Nim/issues/4104 +proc print[T](t: T) # Error: implementation of 'print.print(t: int)' expected +print 42 # moving this line after the implementation fixes the error, + # but such behaviour makes forward declaration pointless +proc print[T](t: T) = + echo t + +echo bar() + |