summary refs log tree commit diff stats
path: root/tests/reject/tconstraints.nim
diff options
context:
space:
mode:
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)"
+
+