diff options
author | konsumlamm <44230978+konsumlamm@users.noreply.github.com> | 2022-11-04 13:32:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 20:32:41 +0800 |
commit | 4491da4c4d090406987650ffd6eb7cea5ded9a19 (patch) | |
tree | bbf094f2636c291354ed70363f581bbe08ff2cc4 | |
parent | ecc8f61fe48515ac35360b88d7bb72f76bc7ed68 (diff) | |
download | Nim-4491da4c4d090406987650ffd6eb7cea5ded9a19.tar.gz |
Support doc comments in new-styled concepts (#20752)
Support comments in new-styled concepts
-rw-r--r-- | compiler/concepts.nim | 2 | ||||
-rw-r--r-- | tests/concepts/t20237.nim | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/compiler/concepts.nim b/compiler/concepts.nim index 89a2bdc10..628e1d4be 100644 --- a/compiler/concepts.nim +++ b/compiler/concepts.nim @@ -61,6 +61,8 @@ proc semConceptDecl(c: PContext; n: PNode): PNode = for i in 0..<n.len-1: result[i] = n[i] result[^1] = semConceptDecl(c, n[^1]) + of nkCommentStmt: + discard else: localError(c.config, n.info, "unexpected construct in the new-styled concept: " & renderTree(n)) result = n diff --git a/tests/concepts/t20237.nim b/tests/concepts/t20237.nim new file mode 100644 index 000000000..db9002421 --- /dev/null +++ b/tests/concepts/t20237.nim @@ -0,0 +1,3 @@ +type Foo = concept + ## doc comment + proc foo(x: Self) |