mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 00:05:25 +00:00
(cherry picked from commit 56c95758b2)
This commit is contained in:
28
tests/metatype/twrong_same_type.nim
Normal file
28
tests/metatype/twrong_same_type.nim
Normal file
@@ -0,0 +1,28 @@
|
||||
# bug #23418
|
||||
|
||||
template mapIt*(x: untyped): untyped =
|
||||
type OutType {.gensym.} = typeof(x) #typeof(x, typeOfProc)
|
||||
newSeq[OutType](5)
|
||||
|
||||
type F[E] = object
|
||||
|
||||
proc start(v: int): F[(ValueError,)] = discard
|
||||
proc stop(v: int): F[tuple[]] = discard
|
||||
|
||||
assert $typeof(mapIt(start(9))) == "seq[F[(ValueError,)]]"
|
||||
assert $typeof(mapIt(stop(9))) == "seq[F[tuple[]]]"
|
||||
|
||||
# bug #23445
|
||||
|
||||
type F2[T; I: static int] = distinct int
|
||||
|
||||
proc start2(v: int): F2[void, 22] = discard
|
||||
proc stop2(v: int): F2[void, 33] = discard
|
||||
|
||||
var a = mapIt(start2(5))
|
||||
|
||||
assert $type(a) == "seq[F2[system.void, 22]]", $type(a)
|
||||
|
||||
var b = mapIt(stop2(5))
|
||||
|
||||
assert $type(b) == "seq[F2[system.void, 33]]", $type(b)
|
||||
Reference in New Issue
Block a user