fixes #21263; consider all candidates for concept matches (#21265)

This commit is contained in:
ringabout 2023-01-18 06:15:23 +08:00 • committed by GitHub
commit cc08a9015e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View file

@ -27,6 +27,8 @@ false
true
-1
Meow
10 0.0
1 2.0
'''
joinable: false
"""
@ -500,3 +502,26 @@ var r, b: Fp2[6, uint64]
prod(r, b)
block: # bug #21263
type
DateDayFraction = concept # no T, an atom
proc date(a: Self): int
proc fraction(b: Self): float
Date = distinct int
DateDayFractionImpl = object
date : int
fraction : float
proc date(a: Date): int = a.int
proc fraction(a:Date): float = 0.0
proc date(a: DateDayFractionImpl): int = a.date
proc fraction(b: DateDayFractionImpl): float = b.fraction
proc print(a: DateDayFraction) =
echo a.date, " ", a.fraction
print(10.Date) # ok
print(DateDayFractionImpl(date: 1, fraction: 2)) # error