fix #959
Variable declarations using a type class will be subject to type inference similar to the one already present in type coercions and the return type inference.
This commit is contained in:
parent
c7116cc121
commit
9a3963f51b
3 changed files with 27 additions and 6 deletions
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got (string) but expected 'ptr'"
|
||||
line: 20
|
||||
"""
|
||||
|
||||
import typetraits
|
||||
|
||||
type
|
||||
|
|
@ -8,3 +13,9 @@ var x = Vec([1, 2, 3])
|
|||
static:
|
||||
assert x.type.name == "Vec[static[int](3), int]"
|
||||
|
||||
var str1: string = "hello, world!"
|
||||
var ptr1: ptr = addr(str1)
|
||||
|
||||
var str2: string = "hello, world!"
|
||||
var ptr2: ptr = str2
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue