summary refs log tree commit diff stats
path: root/tests/concepts
diff options
context:
space:
mode:
authorDaniil Yarancev <21169548+Yardanico@users.noreply.github.com>2018-06-05 21:25:45 +0300
committerGitHub <noreply@github.com>2018-06-05 21:25:45 +0300
commit642641359821b6a63c6cf7edaaa45873b7ea59c7 (patch)
tree627af3020528cb916b3174bd94304307ca875c77 /tests/concepts
parentfb44c522e6173528efa8035ecc459c84887d0167 (diff)
parent3cbc07ac7877b03c605498760fe198e3200cc197 (diff)
downloadNim-642641359821b6a63c6cf7edaaa45873b7ea59c7.tar.gz
Merge pull request #2 from nim-lang/devel
Update
Diffstat (limited to 'tests/concepts')
-rw-r--r--tests/concepts/t3330.nim41
-rw-r--r--tests/concepts/texplain.nim8
-rw-r--r--tests/concepts/tseqofconcept.nim19
-rw-r--r--tests/concepts/tstackconcept.nim2
-rw-r--r--tests/concepts/twrapconcept.nim4
5 files changed, 58 insertions, 16 deletions
diff --git a/tests/concepts/t3330.nim b/tests/concepts/t3330.nim
index 722c0a0e0..a4fff7fb3 100644
--- a/tests/concepts/t3330.nim
+++ b/tests/concepts/t3330.nim
@@ -1,25 +1,48 @@
 discard """
-errormsg: "type mismatch: got (Bar[system.int])"
+errormsg: "type mismatch: got <Bar[system.int]>"
 nimout: '''
-t3330.nim(40, 4) Error: type mismatch: got (Bar[system.int])
+t3330.nim(63, 4) Error: type mismatch: got <Bar[system.int]>
 but expected one of:
 proc test(foo: Foo[int])
-t3330.nim(25, 8) Hint: Non-matching candidates for add(k, string, T)
+t3330.nim(48, 8) Hint: Non-matching candidates for add(k, string, T)
 proc add(x: var string; y: string)
-proc add(result: var string; x: float)
+  first type mismatch at position: 1
+  required type: var string
+  but expression 'k' is of type: Alias
 proc add(x: var string; y: char)
+  first type mismatch at position: 1
+  required type: var string
+  but expression 'k' is of type: Alias
 proc add(result: var string; x: int64)
+  first type mismatch at position: 1
+  required type: var string
+  but expression 'k' is of type: Alias
+proc add(result: var string; x: float)
+  first type mismatch at position: 1
+  required type: var string
+  but expression 'k' is of type: Alias
 proc add(x: var string; y: cstring)
+  first type mismatch at position: 1
+  required type: var string
+  but expression 'k' is of type: Alias
 proc add[T](x: var seq[T]; y: openArray[T])
+  first type mismatch at position: 1
+  required type: var seq[T]
+  but expression 'k' is of type: Alias
 proc add[T](x: var seq[T]; y: T)
+  first type mismatch at position: 1
+  required type: var seq[T]
+  but expression 'k' is of type: Alias
 
-t3330.nim(25, 8) template/generic instantiation from here
-t3330.nim(32, 6) Foo: 'bar.value' cannot be assigned to
-t3330.nim(25, 8) template/generic instantiation from here
-t3330.nim(33, 6) Foo: 'bar.x' cannot be assigned to
-'''
+t3330.nim(48, 8) template/generic instantiation from here
+t3330.nim(55, 6) Foo: 'bar.value' cannot be assigned to
+t3330.nim(48, 8) template/generic instantiation from here
+t3330.nim(56, 6) Foo: 'bar.x' cannot be assigned to
+
+expression: test(bar)'''
 """
 
+
 type
   Foo[T] = concept k
     add(k, string, T)
diff --git a/tests/concepts/texplain.nim b/tests/concepts/texplain.nim
index de8ddf890..4925a25b3 100644
--- a/tests/concepts/texplain.nim
+++ b/tests/concepts/texplain.nim
@@ -26,14 +26,14 @@ texplain.nim(70, 6) ExplainedConcept: undeclared field: '.'
 texplain.nim(70, 6) ExplainedConcept: expression '.' cannot be called
 texplain.nim(69, 5) ExplainedConcept: concept predicate failed
 
-texplain.nim(113, 20) Error: type mismatch: got (NonMatchingType)
+texplain.nim(113, 20) Error: type mismatch: got <NonMatchingType>
 but expected one of:
 proc e(o: ExplainedConcept): int
 texplain.nim(69, 5) ExplainedConcept: concept predicate failed
 proc e(i: int): int
 
 expression: e(n)
-texplain.nim(114, 20) Error: type mismatch: got (NonMatchingType)
+texplain.nim(114, 20) Error: type mismatch: got <NonMatchingType>
 but expected one of:
 proc r(o: RegularConcept): int
 texplain.nim(73, 5) RegularConcept: concept predicate failed
@@ -45,7 +45,7 @@ texplain.nim(115, 20) Hint: Non-matching candidates for r(y)
 proc r[T](a: SomeNumber; b: T; c: auto)
 proc r(i: string): int
 
-texplain.nim(123, 2) Error: type mismatch: got (MatchingType)
+texplain.nim(123, 2) Error: type mismatch: got <MatchingType>
 but expected one of:
 proc f(o: NestedConcept)
 texplain.nim(73, 6) RegularConcept: undeclared field: 'foo'
@@ -61,7 +61,7 @@ texplain.nim(77, 5) NestedConcept: concept predicate failed
 expression: f(y)
 '''
   line: 123
-  errormsg: "type mismatch: got (MatchingType)"
+  errormsg: "type mismatch: got <MatchingType>"
 """
 
 type
diff --git a/tests/concepts/tseqofconcept.nim b/tests/concepts/tseqofconcept.nim
new file mode 100644
index 000000000..5e44117ea
--- /dev/null
+++ b/tests/concepts/tseqofconcept.nim
@@ -0,0 +1,19 @@
+discard """
+output: "1\n2\n3"
+"""
+
+type
+  MyConcept = concept x
+    someProc(x)
+
+  SomeSeq = seq[MyConcept]
+
+proc someProc(x:int) = echo x
+
+proc work (s: SomeSeq) =
+  for item in s:
+    someProc item
+
+var s = @[1, 2, 3]
+work s
+
diff --git a/tests/concepts/tstackconcept.nim b/tests/concepts/tstackconcept.nim
index 2238dacb6..cb8db566d 100644
--- a/tests/concepts/tstackconcept.nim
+++ b/tests/concepts/tstackconcept.nim
@@ -31,7 +31,7 @@ type
     s.pop() is T
 
     type ValueType = T
-    const ValueTypeName = T.name.toUpper
+    const ValueTypeName = T.name.toUpperAscii
 
 proc genericAlgorithm[T](s: var Stack[T], y: T) =
   static:
diff --git a/tests/concepts/twrapconcept.nim b/tests/concepts/twrapconcept.nim
index 25a855e34..377b63afe 100644
--- a/tests/concepts/twrapconcept.nim
+++ b/tests/concepts/twrapconcept.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "type mismatch: got (string)"
+  errormsg: "type mismatch: got <string>"
   line: 21
   nimout: "twrapconcept.nim(11, 5) Foo: concept predicate failed"
 """
@@ -9,7 +9,7 @@ discard """
 type
   Foo = concept foo
     foo.get is int
-  
+
   FooWrap[F: Foo] = object
     foo: F