summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-03-24 16:07:17 +0200
committerZahary Karadjov <zahary@gmail.com>2017-03-24 17:07:30 +0200
commitbec7f9398fe3b90089d4ffb8f0da5ec8574a891d (patch)
tree59228d7a7136d19dc0def5bfb2e9a07240b766b0
parent189d28672cd72053040cafe632c87b1d5cbbc364 (diff)
downloadNim-bec7f9398fe3b90089d4ffb8f0da5ec8574a891d.tar.gz
close #2882
-rw-r--r--tests/concepts/tmisc_issues.nim34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/concepts/tmisc_issues.nim b/tests/concepts/tmisc_issues.nim
index 233739580..10e072521 100644
--- a/tests/concepts/tmisc_issues.nim
+++ b/tests/concepts/tmisc_issues.nim
@@ -6,7 +6,10 @@ true
 p has been called.
 p has been called.
 implicit generic
-generic'''
+generic
+false
+true
+-1'''
 """
 
 # https://github.com/nim-lang/Nim/issues/1147
@@ -66,3 +69,32 @@ c1(@[1])
 proc c2[T](x: Container[T]) = echo "generic"
 c2(@[1])
 
+# https://github.com/nim-lang/Nim/issues/2882
+type
+  Paper = object
+    name: string
+
+  Bendable = concept x
+    bend(x is Bendable)
+
+proc bend(p: Paper): Paper = Paper(name: "bent-" & p.name)
+
+var paper = Paper(name: "red")
+echo paper is Bendable
+
+type
+  A = concept self
+    size(self) is int
+
+  B = object
+
+proc size(self: B): int =
+  return -1  
+
+proc size(self: A): int =
+  return 0  
+
+let b = B()
+echo b is A
+echo b.size()
+