mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-29 18:53:58 +00:00
use 'using' instead of 'sig' keyword; cleans up new features a bit
This commit is contained in:
39
tests/misc/tupcomingfeatures.nim
Normal file
39
tests/misc/tupcomingfeatures.nim
Normal file
@@ -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"
|
||||
Reference in New Issue
Block a user