parent
06571f5495
commit
becb6743f8
2 changed files with 24 additions and 2 deletions
|
|
@ -496,9 +496,15 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
|
||||||
add(result, typeToString(t.sons[i]))
|
add(result, typeToString(t.sons[i]))
|
||||||
result.add "]"
|
result.add "]"
|
||||||
of tyAnd:
|
of tyAnd:
|
||||||
result = typeToString(t.sons[0]) & " and " & typeToString(t.sons[1])
|
for i, son in t.sons:
|
||||||
|
result.add(typeToString(son))
|
||||||
|
if i < t.sons.high:
|
||||||
|
result.add(" and ")
|
||||||
of tyOr:
|
of tyOr:
|
||||||
result = typeToString(t.sons[0]) & " or " & typeToString(t.sons[1])
|
for i, son in t.sons:
|
||||||
|
result.add(typeToString(son))
|
||||||
|
if i < t.sons.high:
|
||||||
|
result.add(" or ")
|
||||||
of tyNot:
|
of tyNot:
|
||||||
result = "not " & typeToString(t.sons[0])
|
result = "not " & typeToString(t.sons[0])
|
||||||
of tyExpr:
|
of tyExpr:
|
||||||
|
|
|
||||||
16
tests/errmsgs/t8434.nim
Normal file
16
tests/errmsgs/t8434.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "type mismatch: got <byte, int literal(0)>"
|
||||||
|
nimout: '''but expected one of:
|
||||||
|
proc fun0[T1: int | float |
|
||||||
|
object | array | seq](a1: T1; a2: int)
|
||||||
|
first type mismatch at position: 1
|
||||||
|
required type: T1: int or float or object or array or seq
|
||||||
|
but expression 'byte(1)' is of type: byte
|
||||||
|
|
||||||
|
expression: fun0(byte(1), 0)
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc fun0[T1:int|float|object|array|seq](a1:T1, a2:int)=discard
|
||||||
|
|
||||||
|
fun0(byte(1), 0)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue