diff options
author | SirOlaf <34164198+SirOlaf@users.noreply.github.com> | 2024-07-20 15:46:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 15:46:25 +0200 |
commit | 9ca646acd4565a72a7115777d58b115787b19b0c (patch) | |
tree | 71be28ce7488d8efb10de10f05414a734328bca2 /compiler/sigmatch.nim | |
parent | 31ee75f10e6482cd482d329507190ac850eee2cf (diff) | |
download | Nim-9ca646acd4565a72a7115777d58b115787b19b0c.tar.gz |
Merge tyUncheckedArray with tySeq in typeRel (#23866)
Ref https://github.com/nim-lang/Nim/issues/23836#issuecomment-2233957324 Their types are basically equivalent so they should behave the same way for type relations.
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 7a12b957b..ba377e08f 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1305,11 +1305,6 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, else: if lengthOrd(c.c.config, fRange) != lengthOrd(c.c.config, aRange): result = isNone - of tyUncheckedArray: - if a.kind == tyUncheckedArray: - result = typeRel(c, elementType(f), elementType(a), flags) - if result < isGeneric: result = isNone - else: discard of tyOpenArray, tyVarargs: # varargs[untyped] is special too but handled earlier. So we only need to # handle varargs[typed]: @@ -1350,9 +1345,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, typeRel(c, base(f), base(a), flags) >= isGeneric: result = isConvertible else: discard - of tySequence: - case a.kind - of tySequence: + of tySequence, tyUncheckedArray: + if a.kind == f.kind: if (f[0].kind != tyGenericParam) and (a.elementType.kind == tyEmpty): result = isSubtype else: @@ -1367,8 +1361,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, result = isSubtype else: result = isNone - of tyNil: result = isNone - else: discard + elif a.kind == tyNil: + result = isNone of tyOrdinal: if isOrdinalType(a): var x = if a.kind == tyOrdinal: a.elementType else: a |