diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/casestmt/tcaseexpr1.nim | 2 | ||||
-rw-r--r-- | tests/generics/tbadgenericlambda.nim | 2 | ||||
-rw-r--r-- | tests/generics/tgeneric0.nim | 2 | ||||
-rw-r--r-- | tests/generics/tgenericlambda.nim | 6 | ||||
-rw-r--r-- | tests/macros/tclosuremacro.nim | 2 | ||||
-rw-r--r-- | tests/misc/tupcomingfeatures.nim | 39 | ||||
-rw-r--r-- | tests/template/tit.nim | 2 | ||||
-rw-r--r-- | tests/typerel/trettypeinference.nim | 6 |
8 files changed, 50 insertions, 11 deletions
diff --git a/tests/casestmt/tcaseexpr1.nim b/tests/casestmt/tcaseexpr1.nim index e5e08e25e..56acbbc8a 100644 --- a/tests/casestmt/tcaseexpr1.nim +++ b/tests/casestmt/tcaseexpr1.nim @@ -11,7 +11,7 @@ discard """ type E = enum A, B, C -proc foo(x): auto = +proc foo(x: int): auto = return case x of 1..9: "digit" else: "number" diff --git a/tests/generics/tbadgenericlambda.nim b/tests/generics/tbadgenericlambda.nim index 2ab8e724d..9fac150c1 100644 --- a/tests/generics/tbadgenericlambda.nim +++ b/tests/generics/tbadgenericlambda.nim @@ -3,5 +3,5 @@ discard """ line: 6 """ -let x = proc (x, y): auto = x + y +let x = proc (x, y: auto): auto = x + y diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim index 45450ccca..a045b32f8 100644 --- a/tests/generics/tgeneric0.nim +++ b/tests/generics/tgeneric0.nim @@ -18,7 +18,7 @@ proc foo[T](p: TType[T, range[0..2]]) = #bug #1366 -proc reversed(x) = +proc reversed(x: auto) = for i in countdown(x.low, x.high): echo i diff --git a/tests/generics/tgenericlambda.nim b/tests/generics/tgenericlambda.nim index eb6ada3e5..41ee74557 100644 --- a/tests/generics/tgenericlambda.nim +++ b/tests/generics/tgenericlambda.nim @@ -5,15 +5,15 @@ discard """ proc test(x: proc (a, b: int): int) = echo x(5, 5) -test(proc (a, b): auto = a + b) +test(proc (a, b: auto): auto = a + b) -test do (a, b) -> auto: a + b +test do (a, b: auto) -> auto: a + b proc foreach[T](s: seq[T], body: proc(x: T)) = for e in s: body(e) -foreach(@[1,2,3]) do (x): +foreach(@[1,2,3]) do (x: auto): echo x proc foo = diff --git a/tests/macros/tclosuremacro.nim b/tests/macros/tclosuremacro.nim index cf51949ed..c29fbe1c8 100644 --- a/tests/macros/tclosuremacro.nim +++ b/tests/macros/tclosuremacro.nim @@ -26,7 +26,7 @@ proc noReturn(x: () -> void) = proc doWithOneAndTwo(f: (int, int) -> int): int = f(1,2) -echo twoParams(proc (a, b): auto = a + b) +echo twoParams(proc (a, b: auto): auto = a + b) echo twoParams((x, y) => x + y) echo oneParam(x => x+5) diff --git a/tests/misc/tupcomingfeatures.nim b/tests/misc/tupcomingfeatures.nim new file mode 100644 index 000000000..9a99e769a --- /dev/null +++ b/tests/misc/tupcomingfeatures.nim @@ -0,0 +1,39 @@ +discard """ + output: '''0 -2 0 + 0 -2''' +""" + +{.this: self.} + +type + Foo {.partial.} = object + a, b: int + +type + tupcomingfeatures.Foo = object + x: int + +proc yay(self: Foo) = + echo a, " ", b, " ", x + +proc footest[T](self: var Foo, a: T) = + b = 1+a + yay() + +proc nongeneric(self: Foo) = + echo a, " ", b + +var ff: Foo +footest(ff, -3) +ff.nongeneric + +{.experimental.} +using + c: Foo + x, y: int + +proc usesSig(c) = + echo "yummy" + +proc foobar(c, y) = + echo "yay" diff --git a/tests/template/tit.nim b/tests/template/tit.nim index 9866711de..cf50d2f6f 100644 --- a/tests/template/tit.nim +++ b/tests/template/tit.nim @@ -5,7 +5,7 @@ template someIt(a, pred: expr): expr = var it {.inject.} = 0 pred -proc aProc(n) = +proc aProc(n: auto) = n.someIt(echo(it)) aProc(89) diff --git a/tests/typerel/trettypeinference.nim b/tests/typerel/trettypeinference.nim index 41b4aa5ef..fa4e89cc8 100644 --- a/tests/typerel/trettypeinference.nim +++ b/tests/typerel/trettypeinference.nim @@ -5,8 +5,8 @@ discard """ import typetraits -proc plus(a, b): auto = a + b -proc makePair(a, b): auto = (first: a, second: b) +proc plus(a, b: auto): auto = a + b +proc makePair(a, b: auto): auto = (first: a, second: b) proc `+`(a, b: string): seq[string] = @[a, b] @@ -19,7 +19,7 @@ static: assert p[0].type is string echo i.type.name echo s.type.name -proc inst(a): auto = +proc inst(a: auto): auto = static: echo "instantiated for ", a.type.name result = a |