Fixed concept constraints for static types (#19391)

This commit is contained in:
Jason Beetham 2022-01-15 01:24:23 -07:00 • committed by GitHub
commit 7bdfeb7819
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 25 deletions

View file

@ -1634,6 +1634,15 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
bindConcreteTypeToUserTypeClass(matched, a)
if doBind: put(c, f, matched)
result = isGeneric
elif a.len > 0 and a.lastSon == f:
# Needed for checking `Y` == `Addable` in the following
#[
type
Addable = concept a, type A
a + a is A
MyType[T: Addable; Y: static T] = object
]#
result = isGeneric
else:
result = isNone