mirror of
https://github.com/nim-lang/Nim.git
synced 2026-09-19 03:24:53 +00:00
two small concept patches (#25076)
- slightly better typeclass logic (eg for bare `range`) - reverse matching now substitutes potential implementation for `Self` --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -497,6 +497,28 @@ block:
|
||||
|
||||
spring({One,Two})
|
||||
|
||||
block: # bare `range`
|
||||
type
|
||||
MyRange = 0..64
|
||||
MyConcept = concept
|
||||
proc a(x: typedesc[Self])
|
||||
|
||||
proc a(x: typedesc[range]) = discard
|
||||
proc spring(x: typedesc[MyConcept]) = discard
|
||||
spring(MyRange)
|
||||
|
||||
block:
|
||||
type
|
||||
A = object
|
||||
TestConcept =
|
||||
concept
|
||||
proc x(x: Self)
|
||||
|
||||
proc x(x: not object) =
|
||||
discard
|
||||
|
||||
assert A isnot TestConcept
|
||||
|
||||
# this code fails inside a block for some reason
|
||||
type Indexable[T] = concept
|
||||
proc `[]`(t: Self, i: int): T
|
||||
|
||||
Reference in New Issue
Block a user