mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
Proper check for tyStatic[T] -> U conversions (#10382)
Drop the outer tyStatic shell then perform the check. Fixes #7609
This commit is contained in:
@@ -108,6 +108,8 @@ const
|
||||
|
||||
proc checkConvertible(c: PContext, castDest, src: PType): TConvStatus =
|
||||
result = convOK
|
||||
# We're interested in the inner type and not in the static tag
|
||||
var src = src.skipTypes({tyStatic})
|
||||
if sameType(castDest, src) and castDest.sym == src.sym:
|
||||
# don't annoy conversions that may be needed on another processor:
|
||||
if castDest.kind notin IntegralTypes+{tyRange}:
|
||||
|
||||
@@ -132,3 +132,8 @@ block:
|
||||
var x = foo(y, 10, 15, [1, 2, 3])
|
||||
doAssert x == (20, 10, 15, 3)
|
||||
|
||||
# #7609
|
||||
block:
|
||||
type
|
||||
Coord[N: static[int]] = tuple[col, row: range[0'i8 .. (N.int8-1)]]
|
||||
Point[N: static[int]] = range[0'i16 .. N.int16 * N.int16 - 1]
|
||||
|
||||
Reference in New Issue
Block a user