diff options
author | flywind <xzsflywind@gmail.com> | 2021-08-21 14:22:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-21 08:22:00 +0200 |
commit | 5b26f2bd81d6fc7d48befbfb4fa3317f713af787 (patch) | |
tree | 02dfbfdc1c49e7d6d7dbd2809a95219b274f6601 /tests/astspec | |
parent | f0c6593412c117c7f8e19421016303416d6b8bd3 (diff) | |
download | Nim-5b26f2bd81d6fc7d48befbfb4fa3317f713af787.tar.gz |
fix deprecated example (#18721)
Diffstat (limited to 'tests/astspec')
-rw-r--r-- | tests/astspec/tastspec.nim | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/astspec/tastspec.nim b/tests/astspec/tastspec.nim index 33a245b1b..c99d8ec79 100644 --- a/tests/astspec/tastspec.nim +++ b/tests/astspec/tastspec.nim @@ -871,11 +871,20 @@ static: scope: macro testRecCase(ast: untyped): untyped = - ast.peelOff({nnkStmtList, nnkTypeSection})[2].matchAst: - of nnkObjectTy( - nnkPragma( - ident"inheritable" + ast.peelOff({nnkStmtList, nnkTypeSection}).matchAst: + of nnkTypeDef( + nnkPragmaExpr( + ident"Obj", + nnkPragma(ident"inheritable") ), + nnkGenericParams( + nnkIdentDefs( + ident"T", + nnkEmpty(), + nnkEmpty()) + ), + nnkObjectTy( + nnkEmpty(), nnkEmpty(), nnkRecList( # list of object parameters nnkIdentDefs( @@ -914,6 +923,7 @@ static: ident"T" ), nnkEmpty() + ) ) ) ) @@ -922,10 +932,8 @@ static: ): echo "ok" - - testRecCase: - type Obj[T] = object {.inheritable.} + type Obj[T] {.inheritable.} = object name: string case isFat: bool of true: |