summary refs log tree commit diff stats
path: root/tests/reject/tconstraints.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-04-01 15:07:16 +0200
committerAraq <rumpf_a@web.de>2011-04-01 15:07:16 +0200
commit4741e8f9a1d1148d58e129626952219e14ede255 (patch)
treedb2eca2249ccc3230dc6c0a7359986198cab4048 /tests/reject/tconstraints.nim
parentdc669155e39007f1b584eef247dff90523f836bf (diff)
downloadNim-4741e8f9a1d1148d58e129626952219e14ede255.tar.gz
ugh, maybe broke git
Diffstat (limited to 'tests/reject/tconstraints.nim')
-rw-r--r--tests/reject/tconstraints.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/reject/tconstraints.nim b/tests/reject/tconstraints.nim
new file mode 100644
index 000000000..aafe86911
--- /dev/null
+++ b/tests/reject/tconstraints.nim
@@ -0,0 +1,18 @@
+discard """
+  line: 15
+  errormsg: "type mismatch: got (int)"
+"""
+
+proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string = 
+  result = $x
+
+type
+  TMyObj = tuple[x, y: int]
+
+var
+  x: TMyObj
+
+assert myGenericProc(232) == "232"
+assert myGenericProc(x) == "(x: 0, y: 0)"
+
+