From d0c2212202e0144834c97bdff8bbdeee84cd97fe Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Thu, 18 Jun 2020 21:05:09 -0700 Subject: [PATCH] close https://github.com/nim-lang/Nim/issues/9679 --- tests/magics/tlambda.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/magics/tlambda.nim b/tests/magics/tlambda.nim index 73851e76bab5b..90f29fdbc3f67 100644 --- a/tests/magics/tlambda.nim +++ b/tests/magics/tlambda.nim @@ -368,6 +368,25 @@ proc test5702() = # fix https://github.com/nim-lang/Nim/issues/5702 foo(1,2,3,4) bar(1,2,3,4) +proc test9679() = # closes https://github.com/nim-lang/Nim/issues/9679 + type + Foo[T] = object + bar*: int + dummy: T + + proc initFoo(T: type, bar: int): Foo[T] = + result.bar = 1 + + proc fails[T](x: static Foo[T]) = + const y = x.bar + + proc works[T](x: T) = + const y = x.bar + + const foo = initFoo(int, 2) + # fails(foo) # fails with static + works(alias2 foo) # works with alias + proc testAll*() = testAlias() testAliasReturn() @@ -382,6 +401,7 @@ proc testAll*() = testMacro() testTemplate() test5702() + test9679() when isMainModule: testAll()