From 7724cd534f3202d956c812bba6b781ea1214562b Mon Sep 17 00:00:00 2001 From: cooldome Date: Mon, 9 Nov 2020 18:24:32 +0000 Subject: [PATCH] fix #15825 (#15894) * fix #15825 * better fix (cherry picked from commit 338602a4021771c8a1cbcedfe30738c67b957646) --- compiler/semtypes.nim | 2 +- tests/destructor/tdestructor3.nim | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 6a644c9f4b..acbab9feab 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1058,7 +1058,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, # disable the bindOnce behavior for the type class result = recurse(paramType.base, true) - of tyAlias, tyOwned: + of tyAlias, tyOwned, tySink: result = recurse(paramType.base) of tySequence, tySet, tyArray, tyOpenArray, diff --git a/tests/destructor/tdestructor3.nim b/tests/destructor/tdestructor3.nim index eb49f3f15e..3f5eb2cc15 100644 --- a/tests/destructor/tdestructor3.nim +++ b/tests/destructor/tdestructor3.nim @@ -172,3 +172,14 @@ when true: # D20200607T202043 main2() + +#------------------------------------------------------------ +# Issue #15825 + +type + Union = string | int | char + +proc run(a: sink Union) = + discard + +run("123")