Fixed generic distinct conversions for 'var' (#18837)
* SameTypeAux now properly traverses generic distincts * Smarter traversal of distincts * Removed redundant check * Fixed nkConv for jsgen * Added test for non distinct nkConv * using skiptypes for distinct now * Fixed genaddr for nkconv
This commit is contained in:
parent
3ecb369ca1
commit
83a2515af7
4 changed files with 104 additions and 67 deletions
|
|
@ -8,6 +8,7 @@ false
|
|||
false
|
||||
false
|
||||
Foo
|
||||
foo
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -140,6 +141,22 @@ block tRequiresInit:
|
|||
let s = "test"
|
||||
doAssert s == "test"
|
||||
|
||||
block: #17322
|
||||
type
|
||||
A[T] = distinct string
|
||||
|
||||
proc foo(a: var A) =
|
||||
a.string.add "foo"
|
||||
|
||||
type
|
||||
B = distinct A[int]
|
||||
|
||||
var b: B
|
||||
foo(A[int](b))
|
||||
echo A[int](b).string
|
||||
b.string.add "bar"
|
||||
assert b.string == "foobar"
|
||||
|
||||
type Foo = distinct string
|
||||
|
||||
template main() =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue