mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-28 10:13:56 +00:00
* fixes #19278; make `privateAccess` work with generic ref object * fixes
This commit is contained in:
@@ -26,6 +26,12 @@ type
|
||||
H1*[T] = ref H2[T]
|
||||
H*[T] = H1[T]
|
||||
|
||||
Pity[T] = object
|
||||
a: T
|
||||
PityRef*[T] = ref Pity[T]
|
||||
Hope*[T] = ref object
|
||||
a: T
|
||||
|
||||
type BAalias* = typeof(B.default)
|
||||
# typeof is not a transparent abstraction, creates a `tyAlias`
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import std/importutils
|
||||
import std/[importutils, assertions]
|
||||
import stdtest/testutils
|
||||
import mimportutils
|
||||
|
||||
@@ -134,5 +134,14 @@ template main =
|
||||
privateAccess PtA
|
||||
a.ha1 == 0
|
||||
|
||||
block:
|
||||
privateAccess PityRef
|
||||
let x = PityRef[int](a: 1) # works
|
||||
doAssert x.a == 1
|
||||
|
||||
privateAccess Hope
|
||||
let y = Hope[int](a: 1)
|
||||
doAssert y.a == 1
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user