parent
510e383d92
commit
0286a0879b
2 changed files with 31 additions and 0 deletions
|
|
@ -1059,6 +1059,13 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
|
||||||
# disable the bindOnce behavior for the type class
|
# disable the bindOnce behavior for the type class
|
||||||
result = recurse(paramType.base, true)
|
result = recurse(paramType.base, true)
|
||||||
|
|
||||||
|
of tyTuple:
|
||||||
|
for i in 0..<paramType.len:
|
||||||
|
let t = recurse(paramType[i])
|
||||||
|
if t != nil:
|
||||||
|
paramType[i] = t
|
||||||
|
result = paramType
|
||||||
|
|
||||||
of tyAlias, tyOwned, tySink:
|
of tyAlias, tyOwned, tySink:
|
||||||
result = recurse(paramType.base)
|
result = recurse(paramType.base)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,27 @@ aa.x = 666
|
||||||
|
|
||||||
p aa
|
p aa
|
||||||
q aa
|
q aa
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
# issue #16651
|
||||||
|
type
|
||||||
|
PointTup = tuple
|
||||||
|
x: float32
|
||||||
|
y: float32
|
||||||
|
|
||||||
|
converter tupleToPoint[T1, T2: SomeFloat](self: tuple[x: T1, y: T2]): PointTup =
|
||||||
|
result = (self.x.float32, self.y.float32)
|
||||||
|
|
||||||
|
proc tupleToPointX(self: tuple[x: SomeFloat, y: SomeFloat]): PointTup =
|
||||||
|
result = (self.x.float32, self.y.float32)
|
||||||
|
|
||||||
|
proc tupleToPointX2(self: tuple[x: SomeFloat, y: distinct SomeFloat]): PointTup =
|
||||||
|
result = (self.x.float32, self.y.float32)
|
||||||
|
|
||||||
|
var t1: PointTup = tupleToPointX((1.0, 0.0))
|
||||||
|
var t2: PointTup = tupleToPointX2((1.0, 0.0))
|
||||||
|
var t3: PointTup = tupleToPointX2((1.0'f32, 0.0))
|
||||||
|
var t4: PointTup = tupleToPointX2((1.0, 0.0'f32))
|
||||||
|
|
||||||
|
var x2: PointTup = (1.0, 0.0)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue