This commit is contained in:
Araq
2015-09-18 12:07:39 +02:00
parent c921f30b1d
commit fd80a51547
3 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
proc myFun[A,B](x: A): B =
proc myFun[A](x: A): auto =
result = float(x+10)
proc myMap[T,S](sIn: seq[T], f: proc (q: T): S): seq[S] =

View File

@@ -0,0 +1,20 @@
discard """
errormsg: "cannot instantiate: 'T'"
line: 12
"""
# bug #2594
type
ResultValue* = int64
proc toNumber[T: int|uint|int64|uint64](v: ResultValue): T =
if v < low(T) or v > high(T):
raise newException(RangeError, "protocol error")
return T(v)
#proc toNumber[T](v: int32): T =
# return (v)
echo toNumber(23)