new-style concepts implementation, WIP (#15251)
* fixes #15210 [backport:1.2] * make tests green * make ordinal work * makes Swapable test compile * make Indexable example work * concepts: 'self' is now 'Self' * concepts: make Dictionary example compile * document the new concept implementation * concepts: make typeDesc work properly * concepts: allow documentation comments (d'oh)
This commit is contained in:
parent
3f38f8fbb7
commit
6278b5d89a
19 changed files with 528 additions and 59 deletions
|
|
@ -434,9 +434,8 @@ type
|
|||
# instantiation and prior to this it has the potential to
|
||||
# be any type.
|
||||
|
||||
tyOptDeprecated
|
||||
# 'out' parameter. Comparable to a 'var' parameter but every
|
||||
# path must assign a value to it before it can be read from.
|
||||
tyConcept
|
||||
# new style concept.
|
||||
|
||||
tyVoid
|
||||
# now different from tyEmpty, hurray!
|
||||
|
|
@ -1975,3 +1974,7 @@ proc toHumanStr*(kind: TTypeKind): string =
|
|||
|
||||
proc skipAddr*(n: PNode): PNode {.inline.} =
|
||||
(if n.kind == nkHiddenAddr: n[0] else: n)
|
||||
|
||||
proc isNewStyleConcept*(n: PNode): bool {.inline.} =
|
||||
assert n.kind == nkTypeClassTy
|
||||
result = n[0].kind == nkEmpty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue