diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-01-18 06:15:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-17 23:15:23 +0100 |
commit | cc08a9015e446471be8b734c2895d99c91c59cb3 (patch) | |
tree | 9ecf4c79d650d875433a99d9c3d509d671f493c9 /tests | |
parent | 30da566d9dc81feab9ba3015d293d93b5c6785af (diff) | |
download | Nim-cc08a9015e446471be8b734c2895d99c91c59cb3.tar.gz |
fixes #21263; consider all candidates for concept matches (#21265)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/concepts/tconcepts_issues.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/concepts/tconcepts_issues.nim b/tests/concepts/tconcepts_issues.nim index 802582f57..3efb9964a 100644 --- a/tests/concepts/tconcepts_issues.nim +++ b/tests/concepts/tconcepts_issues.nim @@ -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 |