Fix subranges of distinct types (#18816) [backport]

This commit is contained in:
Jason Beetham 2021-09-07 09:11:08 -06:00 • committed by GitHub
commit ee2eb5cae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -124,7 +124,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
result = typeAllowedAux(marker, lastSon(t), kind, c, flags)
of tyRange:
if skipTypes(t[0], abstractInst-{tyTypeDesc}).kind notin
{tyChar, tyEnum, tyInt..tyFloat128, tyInt..tyUInt64}: result = t
{tyChar, tyEnum, tyInt..tyFloat128, tyInt..tyUInt64, tyRange}: result = t
of tyOpenArray:
# you cannot nest openArrays/sinks/etc.
if (kind != skParam or taIsOpenArray in flags) and views notin c.features: