better error messages: use <T1, T2> instead of (T1, T2) in order to prevent confusions with tuple types

This commit is contained in:
Araq 2018-02-10 20:39:05 +01:00
commit ef6eda4cb4
25 changed files with 62 additions and 62 deletions

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (array[0..2, float], array[0..1, float])"
errormsg: "type mismatch: got <array[0..2, float], array[0..1, float]>"
"""
proc `+`*[R, T] (v1, v2: array[R, T]): array[R, T] =

View file

@ -1,38 +1,38 @@
discard """
errormsg: "type mismatch: got (Bar[system.int])"
errormsg: "type mismatch: got <Bar[system.int]>"
nimout: '''
t3330.nim(63, 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(48, 8) Hint: Non-matching candidates for add(k, string, T)
proc add(x: var string; y: string)
first type mismatch at position: 1
required type: var string
but expression 'k' is of type: Alias
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
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
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
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
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
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
first type mismatch at position: 1
required type: var seq[T]
but expression 'k' is of type: Alias
t3330.nim(48, 8) template/generic instantiation from here
t3330.nim(55, 6) Foo: 'bar.value' cannot be assigned to

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (string, arr: seq[empty])"
errormsg: "type mismatch: got <string, arr: seq[empty]>"
line: 15
"""

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (proc [*missing parameters*](x: int) | proc (x: string){.gcsafe, locks: 0.})"
errormsg: "type mismatch: got <proc [*missing parameters*](x: int) | proc (x: string){.gcsafe, locks: 0.}>"
line: 19
"""

View file

@ -2,15 +2,15 @@ discard """
errormsg: "cannot instantiate B"
line: 20
nimout: '''
got: (type string)
but expected: (T: A)
got: <type string>
but expected: <T: A>
'''
"""
type
A = concept c
advance(c)
B[T: A] = object
child: ref B[T]

View file

@ -1,13 +1,13 @@
discard """
cmd: "nim check $file"
errormsg: "type mismatch: got (int literal(1), int literal(2), int literal(3))"
errormsg: "type mismatch: got <int literal(1), int literal(2), int literal(3)>"
nimout: '''
but expected one of:
proc main(a, b, c: string)
first type mismatch at position: 1
required type: string
but expression '1' is of type: int literal(1)
first type mismatch at position: 1
required type: string
but expression '1' is of type: int literal(1)
expression: main(1, 2, 3)
'''

View file

@ -2,8 +2,8 @@ discard """
errormsg: "cannot instantiate B"
line: 14
nimout: '''
got: (type int)
but expected: (T: string or float)
got: <type int>
but expected: <T: string or float>
'''
"""

View file

@ -1,7 +1,7 @@
discard """
errormsg: '''got (tuple of (type NimEdAppWindow, int))'''
errormsg: '''got <tuple of (type NimEdAppWindow, int)>'''
line: 22
nimout: '''got (tuple of (type NimEdAppWindow, int))
nimout: '''got <tuple of (type NimEdAppWindow, int)>
but expected one of:
template xxx(tn: typedesc; i: int)'''
"""

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (int) but expected 'cshort = int16'"
errormsg: "type mismatch: got <int> but expected 'cshort = int16'"
line: 12
column: 10
file: "tshow_asgn.nim"

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (Future[system.int], void)"
errormsg: "type mismatch: got <Future[system.int], void>"
line: 20
"""

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (PTest)"
errormsg: "type mismatch: got <PTest>"
"""
type

View file

@ -1,6 +1,6 @@
discard """
line: 16
errormsg: "type mismatch: got (void)"
errormsg: "type mismatch: got <void>"
"""
# bug #950

View file

@ -1,5 +1,5 @@
discard """
errormsg: "type mismatch: got (FooRef[system.string])"
errormsg: "type mismatch: got <FooRef[system.string]>"
line: 15
"""

View file

@ -1,6 +1,6 @@
discard """
line: 6
errormsg: "type mismatch: got (int literal(1)) but expected 'bool'"
errormsg: "type mismatch: got <int literal(1)> but expected 'bool'"
"""
if 1:

View file

@ -1,7 +1,7 @@
discard """
file: "tnocontains.nim"
line: 10
errormsg: "type mismatch: got (string, string)"
errormsg: "type mismatch: got <string, string>"
"""
# shouldn't compile since it doesn't do what you think it does without

View file

@ -1,6 +1,6 @@
discard """
line: 16
errormsg: "type mismatch: got (BPtr) but expected 'APtr = ptr[RegionA, int]'"
errormsg: "type mismatch: got <BPtr> but expected 'APtr = ptr[RegionA, int]'"
"""
type

View file

@ -1,6 +1,6 @@
discard """
line: 6
errormsg: "type mismatch: got (type int)"
errormsg: "type mismatch: got <type int>"
"""
# bug #3079, #1146
echo repr(int)

View file

@ -1,7 +1,7 @@
discard """
file: "ttypenoval.nim"
line: 38
errormsg: "type mismatch: got (type int) but expected 'int'"
errormsg: "type mismatch: got <type int> but expected 'int'"
"""
# A min-heap.