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
|
|
@ -1195,7 +1195,8 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
|||
cycleCheck()
|
||||
result = sameTypeAux(a.lastSon, b.lastSon, c)
|
||||
of tyNone: result = false
|
||||
of tyOptDeprecated: doAssert false
|
||||
of tyConcept:
|
||||
result = exprStructuralEquivalent(a.n, b.n)
|
||||
|
||||
proc sameBackendType*(x, y: PType): bool =
|
||||
var c = initSameTypeClosure()
|
||||
|
|
@ -1271,6 +1272,7 @@ proc matchType*(a: PType, pattern: openArray[tuple[k:TTypeKind, i:int]],
|
|||
a = a[i]
|
||||
result = a.kind == last
|
||||
|
||||
|
||||
include sizealignoffsetimpl
|
||||
|
||||
proc computeSize*(conf: ConfigRef; typ: PType): BiggestInt =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue