parent
5d1608c976
commit
3f3e0fa303
2 changed files with 40 additions and 2 deletions
|
|
@ -344,7 +344,11 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
||||||
x = lookupTypeVar(cl, x)
|
x = lookupTypeVar(cl, x)
|
||||||
if x != nil:
|
if x != nil:
|
||||||
if header == t: header = instCopyType(cl, t)
|
if header == t: header = instCopyType(cl, t)
|
||||||
header[i] = x
|
header[i] =
|
||||||
|
if x.kind == tyGenericInst:
|
||||||
|
t[i]
|
||||||
|
else:
|
||||||
|
x
|
||||||
propagateToOwner(header, x)
|
propagateToOwner(header, x)
|
||||||
else:
|
else:
|
||||||
propagateToOwner(header, x)
|
propagateToOwner(header, x)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
block: # Replicates #18728
|
block: # Replicates #18728
|
||||||
type
|
type
|
||||||
FlipFlop[A, B] = ref object
|
FlipFlop[A, B] = ref object
|
||||||
|
val: A
|
||||||
next: FlipFlop[B, A]
|
next: FlipFlop[B, A]
|
||||||
|
|
||||||
Trinary[A, B, C] = ref object
|
Trinary[A, B, C] = ref object
|
||||||
|
|
@ -10,3 +11,36 @@ block: # Replicates #18728
|
||||||
assert typeof(FlipFlop[string, int]().next) is FlipFlop[int, string]
|
assert typeof(FlipFlop[string, int]().next) is FlipFlop[int, string]
|
||||||
assert typeof(Trinary[int, float, string]().next) is Trinary[float, string, int]
|
assert typeof(Trinary[int, float, string]().next) is Trinary[float, string, int]
|
||||||
assert typeof(Trinary[int, float, string]().next.next) is Trinary[string, int, float]
|
assert typeof(Trinary[int, float, string]().next.next) is Trinary[string, int, float]
|
||||||
|
var a = FlipFlop[int, string](val: 100, next: FlipFlop[string, int](val: "Hello"))
|
||||||
|
assert a.val == 100
|
||||||
|
assert a.next.val == "Hello"
|
||||||
|
|
||||||
|
block: # 18838
|
||||||
|
type
|
||||||
|
DoublyLinkedNodeObj[T] = object
|
||||||
|
value: T
|
||||||
|
|
||||||
|
DoublyLinkedNode[T] = ref DoublyLinkedNodeObj[T]
|
||||||
|
|
||||||
|
Item[T] = ref object
|
||||||
|
link: DoublyLinkedNode[Item[T]]
|
||||||
|
|
||||||
|
Box = object
|
||||||
|
|
||||||
|
proc newDoublyLinkedNode[T](value: T): DoublyLinkedNode[T] =
|
||||||
|
new(result)
|
||||||
|
result.value = value
|
||||||
|
|
||||||
|
let link = newDoublyLinkedNode(Item[Box]())
|
||||||
|
|
||||||
|
import lists
|
||||||
|
block:
|
||||||
|
type
|
||||||
|
Box = object
|
||||||
|
Item[T] = ref object
|
||||||
|
link:DoublyLinkedNode[ Item[T] ]
|
||||||
|
|
||||||
|
ItemSimple = ref object
|
||||||
|
link:DoublyLinkedNode[ ItemSimple ]
|
||||||
|
|
||||||
|
let link = newDoublyLinkedNode( Item[Box]() )
|
||||||
Loading…
Add table
Add a link
Reference in a new issue