fixes #4084
This commit is contained in:
parent
c870e831c8
commit
e04f319540
4 changed files with 38 additions and 10 deletions
16
tests/generics/twrong_explicit_typeargs.nim
Normal file
16
tests/generics/twrong_explicit_typeargs.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got (string) but expected 'int32 or int64'"
|
||||
line: 16
|
||||
"""
|
||||
|
||||
# bug #4084
|
||||
type
|
||||
Image[T] = object
|
||||
data: seq[T]
|
||||
|
||||
proc newImage[T: int32|int64](w, h: int): ref Image[T] =
|
||||
new(result)
|
||||
result.data = newSeq[T](w * h)
|
||||
|
||||
var correct = newImage[int32](320, 200)
|
||||
var wrong = newImage[string](320, 200)
|
||||
Loading…
Add table
Add a link
Reference in a new issue