summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorkonsumlamm <44230978+konsumlamm@users.noreply.github.com>2022-11-04 13:32:41 +0100
committerGitHub <noreply@github.com>2022-11-04 20:32:41 +0800
commit4491da4c4d090406987650ffd6eb7cea5ded9a19 (patch)
treebbf094f2636c291354ed70363f581bbe08ff2cc4
parentecc8f61fe48515ac35360b88d7bb72f76bc7ed68 (diff)
downloadNim-4491da4c4d090406987650ffd6eb7cea5ded9a19.tar.gz
Support doc comments in new-styled concepts (#20752)
Support comments in new-styled concepts
-rw-r--r--compiler/concepts.nim2
-rw-r--r--tests/concepts/t20237.nim3
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)