This commit is contained in:
Zahary Karadjov 2014-12-31 12:58:22 +02:00
commit 70b5efa98d
2 changed files with 13 additions and 12 deletions

View file

@ -629,6 +629,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
elif skipTypes(a, {tyRange}).kind == f.kind: result = isSubtype elif skipTypes(a, {tyRange}).kind == f.kind: result = isSubtype
of tyRange: of tyRange:
if a.kind == f.kind: if a.kind == f.kind:
if f.base.kind == tyNone: return isGeneric
result = typeRel(c, base(f), base(a)) result = typeRel(c, base(f), base(a))
# bugfix: accept integer conversions here # bugfix: accept integer conversions here
#if result < isGeneric: result = isNone #if result < isGeneric: result = isNone
@ -948,7 +949,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
else: else:
internalAssert a.sons != nil and a.sons.len > 0 internalAssert a.sons != nil and a.sons.len > 0
c.typedescMatched = true c.typedescMatched = true
result = typeRel(c, f.base, a.base) result = typeRel(c, f.base, a.skipTypes({tyGenericParam, tyTypeDesc}))
else: else:
result = isNone result = isNone
else: else:

View file

@ -51,7 +51,7 @@ while i < s.len:
write(stdout, "Du heißt " & s) write(stdout, "Du heißt " & s)
# bug #544 # bug #544
when false:
# yay, fails again # yay, fails again
type Bar [T; I:range] = array[I, T] type Bar [T; I:range] = array[I, T]
proc foo*[T; I:range](a, b: Bar[T, I]): Bar[T, I] = proc foo*[T; I:range](a, b: Bar[T, I]): Bar[T, I] =
@ -60,7 +60,7 @@ when false:
{.fatal:"Dimensions have to be 3".} {.fatal:"Dimensions have to be 3".}
#... #...
block: block:
var a, b: Bar[int, 0..2] var a, b: Bar[int, range[0..2]]
discard foo(a, b) discard foo(a, b)
# bug #1788 # bug #1788