mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
@@ -344,7 +344,11 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
||||
x = lookupTypeVar(cl, x)
|
||||
if x != nil:
|
||||
if header == t: header = instCopyType(cl, t)
|
||||
header[i] = x
|
||||
header[i] =
|
||||
if x.kind == tyGenericInst:
|
||||
t[i]
|
||||
else:
|
||||
x
|
||||
propagateToOwner(header, x)
|
||||
else:
|
||||
propagateToOwner(header, x)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
block: # Replicates #18728
|
||||
type
|
||||
FlipFlop[A, B] = ref object
|
||||
val: A
|
||||
next: FlipFlop[B, A]
|
||||
|
||||
Trinary[A, B, C] = ref object
|
||||
@@ -9,4 +10,37 @@ block: # Replicates #18728
|
||||
assert typeof(FlipFlop[int, string]().next) is FlipFlop[string, int]
|
||||
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.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]() )
|
||||
Reference in New Issue
Block a user