Skip to content

Commit fbc220a

Browse files
committed
Revert "Revert "Enable cmark smart punctuation in doc comments""
This reverts commit f723b86 and updates the IDE tests that incidentally included some punctuation. No new tests are necessary - the character level tests are exercised in cmark itself.
1 parent f723b86 commit fbc220a

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

lib/Markup/Markup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ parseElement(MarkupContext &MC, LineList &LL, ParseState State) {
320320
Document *llvm::markup::parseDocument(MarkupContext &MC, LineList &LL) {
321321
auto Comment = LL.str();
322322
auto CMarkDoc = cmark_parse_document(Comment.c_str(), Comment.size(),
323-
CMARK_OPT_DEFAULT);
323+
CMARK_OPT_SMART);
324324

325325
if (CMarkDoc == nullptr)
326326
return nullptr;

test/IDE/comment_extensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Content is in separate file in ./Inputs due to the "requires" keyword getting
44
// recognized by lit.
55

6-
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>attention()</Name><USR>s:F14swift_ide_test9attentionFT_T_</USR><Declaration>func attention()</Declaration><Discussion><Attention><Para>This function is so hip and exciting, it can&apos;t be trusted.</Para></Attention></Discussion></Function>]
6+
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}} line="{{.*}}" column="{{.*}}"><Name>attention()</Name><USR>s:F14swift_ide_test9attentionFT_T_</USR><Declaration>func attention()</Declaration><Discussion><Attention><Para>This function is so hip and exciting, it cant be trusted.</Para></Attention></Discussion></Function>]
77

88
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>author()</Name><USR>s:F14swift_ide_test6authorFT_T_</USR><Declaration>func author()</Declaration><Discussion><Author><Para>Stephen</Para></Author></Discussion></Function>]
99

@@ -38,7 +38,7 @@
3838

3939
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>requires()</Name><USR>s:F14swift_ide_test8requiresFT_T_</USR><Declaration>func requires()</Declaration><Discussion><Requires><Para></Para><List-Bullet><Item><Para>explicit package name. Just kidding!</Para></Item></List-Bullet></Requires></Discussion></Function>]
4040

41-
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>see()</Name><USR>s:F14swift_ide_test3seeFT_T_</USR><Declaration>func see()</Declaration><Discussion><See><Para>the pie (it&apos;s very good).</Para></See></Discussion></Function>]
41+
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>see()</Name><USR>s:F14swift_ide_test3seeFT_T_</USR><Declaration>func see()</Declaration><Discussion><See><Para>the pie (its very good).</Para></See></Discussion></Function>] CommentXMLValid
4242

4343
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>since()</Name><USR>s:F14swift_ide_test5sinceFT_T_</USR><Declaration>func since()</Declaration><Discussion><Since><Para>1809</Para></Since></Discussion></Function>]
4444

test/SourceKit/CursorInfo/cursor_info.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ typealias MyVoid = ()
257257
// CHECK6-NEXT: FooSwiftModule
258258
// CHECK6-NEXT: <Declaration>func fooSwiftFunc() -&gt; <Type usr="s:Si">Int</Type></Declaration>
259259
// CHECK6-NEXT: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>fooSwiftFunc</decl.name>() -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.function.free>
260-
// CHECK6-NEXT: {{^}}<Function><Name>fooSwiftFunc()</Name><USR>s:F14FooSwiftModule12fooSwiftFuncFT_Si</USR><Declaration>func fooSwiftFunc() -&gt; Int</Declaration><Abstract><Para>This is &apos;fooSwiftFunc&apos; from &apos;FooSwiftModule&apos;.</Para></Abstract></Function>{{$}}
260+
// CHECK6-NEXT: {{^}}<Function><Name>fooSwiftFunc()</Name><USR>s:F14FooSwiftModule12fooSwiftFuncFT_Si</USR><Declaration>func fooSwiftFunc() -&gt; Int</Declaration><Abstract><Para>This is fooSwiftFunc from FooSwiftModule.</Para></Abstract></Function>{{$}}
261261

262262
// RUN: %sourcekitd-test -req=cursor -pos=14:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK7 %s
263263
// CHECK7: source.lang.swift.ref.struct (13:8-13:10)

test/SourceKit/DocSupport/doc_clang_module.swift.response

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,7 +6224,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
62246224
key.name: "toIntMax()",
62256225
key.usr: "s:FSi8toIntMaxFT_Vs5Int64::SYNTHESIZED::c:@E@FooComparisonResult",
62266226
key.original_usr: "s:FSi8toIntMaxFT_Vs5Int64",
6227-
key.doc.full_as_xml: "<Function><Name>toIntMax()</Name><USR>s:FSi8toIntMaxFT_Vs5Int64</USR><Declaration>func toIntMax() -&gt; IntMax</Declaration><Abstract><Para>Represent this number using Swift&apos;s widest native signed integer type.</Para></Abstract></Function>",
6227+
key.doc.full_as_xml: "<Function><Name>toIntMax()</Name><USR>s:FSi8toIntMaxFT_Vs5Int64</USR><Declaration>func toIntMax() -&gt; IntMax</Declaration><Abstract><Para>Represent this number using Swifts widest native signed integer type.</Para></Abstract></Function>",
62286228
key.offset: 1169,
62296229
key.length: 25,
62306230
key.fully_annotated_decl: "<decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>toIntMax</decl.name>() -&gt; <decl.function.returntype><ref.typealias usr=\"s:s6IntMax\">IntMax</ref.typealias></decl.function.returntype></decl.function.method.instance>",
@@ -6463,7 +6463,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
64636463
key.name: "init(bitPattern:)",
64646464
key.usr: "s:FSicFT10bitPatternSu_Si::SYNTHESIZED::c:@E@FooComparisonResult",
64656465
key.original_usr: "s:FSicFT10bitPatternSu_Si",
6466-
key.doc.full_as_xml: "<Function><Name>init(bitPattern:)</Name><USR>s:FSicFT10bitPatternSu_Si</USR><Declaration>init(bitPattern: UInt)</Declaration><Abstract><Para>Construct a <codeVoice>Int</codeVoice> having the same memory representation as the <codeVoice>UInt</codeVoice> <codeVoice>bitPattern</codeVoice>. No range or overflow checking occurs, and the resulting <codeVoice>Int</codeVoice> may not have the same numeric value as <codeVoice>bitPattern</codeVoice>--it is only guaranteed to use the same pattern of bits.</Para></Abstract></Function>",
6466+
key.doc.full_as_xml: "<Function><Name>init(bitPattern:)</Name><USR>s:FSicFT10bitPatternSu_Si</USR><Declaration>init(bitPattern: UInt)</Declaration><Abstract><Para>Construct a <codeVoice>Int</codeVoice> having the same memory representation as the <codeVoice>UInt</codeVoice> <codeVoice>bitPattern</codeVoice>. No range or overflow checking occurs, and the resulting <codeVoice>Int</codeVoice> may not have the same numeric value as <codeVoice>bitPattern</codeVoice>it is only guaranteed to use the same pattern of bits.</Para></Abstract></Function>",
64676467
key.offset: 1520,
64686468
key.length: 33,
64696469
key.fully_annotated_decl: "<decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.argument_label>bitPattern</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr=\"s:Su\">UInt</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.constructor>",
@@ -6539,7 +6539,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
65396539
key.name: "init(_:radix:)",
65406540
key.usr: "s:FSicFTSS5radixSi_GSqSi_::SYNTHESIZED::c:@E@FooComparisonResult",
65416541
key.original_usr: "s:FSicFTSS5radixSi_GSqSi_",
6542-
key.doc.full_as_xml: "<Function><Name>init(_:radix:)</Name><USR>s:FSicFTSS5radixSi_GSqSi_</USR><Declaration>init?(_ text: String, radix: Int = default)</Declaration><Abstract><Para>Construct from an ASCII representation in the given <codeVoice>radix</codeVoice>.</Para></Abstract><Discussion><Para>If <codeVoice>text</codeVoice> does not match the regular expression &quot;[+-]?[0-9a-zA-Z]+&quot;, or the value it denotes in the given <codeVoice>radix</codeVoice> is not representable, the result is <codeVoice>nil</codeVoice>.</Para></Discussion></Function>",
6542+
key.doc.full_as_xml: "<Function><Name>init(_:radix:)</Name><USR>s:FSicFTSS5radixSi_GSqSi_</USR><Declaration>init?(_ text: String, radix: Int = default)</Declaration><Abstract><Para>Construct from an ASCII representation in the given <codeVoice>radix</codeVoice>.</Para></Abstract><Discussion><Para>If <codeVoice>text</codeVoice> does not match the regular expression [+-]?[0-9a-zA-Z]+, or the value it denotes in the given <codeVoice>radix</codeVoice> is not representable, the result is <codeVoice>nil</codeVoice>.</Para></Discussion></Function>",
65436543
key.offset: 1640,
65446544
key.length: 49,
65456545
key.fully_annotated_decl: "<decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>?(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>text</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr=\"s:SS\">String</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>radix</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr=\"s:Si\">Int</ref.struct></decl.var.parameter.type> = <syntaxtype.keyword>default</syntaxtype.keyword></decl.var.parameter>)</decl.function.constructor>",
@@ -7132,7 +7132,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
71327132
key.description: "RawValue : BitwiseOperations"
71337133
}
71347134
],
7135-
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions where RawValue : BitwiseOperations</Declaration><Abstract><Para><codeVoice>OptionSet</codeVoice> requirements for which default implementations are supplied when <codeVoice>RawValue</codeVoice> conforms to <codeVoice>BitwiseOperations</codeVoice>, which is the usual case. Each distinct bit of an option set&apos;s <codeVoice>.rawValue</codeVoice> corresponds to a disjoint element of the option set.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>OptionSet</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note><List-Bullet><Item><Para><codeVoice>union</codeVoice> is implemented as a bitwise &quot;or&quot; (<codeVoice>|</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>intersection</codeVoice> is implemented as a bitwise &quot;and&quot; (<codeVoice>|</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>exclusiveOr</codeVoice> is implemented as a bitwise &quot;exclusive or&quot; (<codeVoice>^</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item></List-Bullet></Discussion></Other>",
7135+
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions where RawValue : BitwiseOperations</Declaration><Abstract><Para><codeVoice>OptionSet</codeVoice> requirements for which default implementations are supplied when <codeVoice>RawValue</codeVoice> conforms to <codeVoice>BitwiseOperations</codeVoice>, which is the usual case. Each distinct bit of an option set’s <codeVoice>.rawValue</codeVoice> corresponds to a disjoint element of the option set.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>OptionSet</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note><List-Bullet><Item><Para><codeVoice>union</codeVoice> is implemented as a bitwise “or” (<codeVoice>|</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>intersection</codeVoice> is implemented as a bitwise “and” (<codeVoice>|</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>exclusiveOr</codeVoice> is implemented as a bitwise “exclusive or” (<codeVoice>^</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item></List-Bullet></Discussion></Other>",
71367136
key.offset: 3039,
71377137
key.length: 206,
71387138
key.extends: {

test/SourceKit/DocSupport/doc_swift_module.swift.response

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,7 @@ func genfoo<T1 : Prot, T2 : cake.C1 where T1.Element == Int, T2.Element == T1.El
23472347
key.name: "toIntMax()",
23482348
key.usr: "s:FSi8toIntMaxFT_Vs5Int64::SYNTHESIZED::s:O4cake6MyEnum",
23492349
key.original_usr: "s:FSi8toIntMaxFT_Vs5Int64",
2350-
key.doc.full_as_xml: "<Function><Name>toIntMax()</Name><USR>s:FSi8toIntMaxFT_Vs5Int64</USR><Declaration>func toIntMax() -&gt; IntMax</Declaration><Abstract><Para>Represent this number using Swift&apos;s widest native signed integer type.</Para></Abstract></Function>",
2350+
key.doc.full_as_xml: "<Function><Name>toIntMax()</Name><USR>s:FSi8toIntMaxFT_Vs5Int64</USR><Declaration>func toIntMax() -&gt; IntMax</Declaration><Abstract><Para>Represent this number using Swifts widest native signed integer type.</Para></Abstract></Function>",
23512351
key.offset: 678,
23522352
key.length: 25,
23532353
key.fully_annotated_decl: "<decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>toIntMax</decl.name>() -&gt; <decl.function.returntype><ref.typealias usr=\"s:s6IntMax\">IntMax</ref.typealias></decl.function.returntype></decl.function.method.instance>",
@@ -2586,7 +2586,7 @@ func genfoo<T1 : Prot, T2 : cake.C1 where T1.Element == Int, T2.Element == T1.El
25862586
key.name: "init(bitPattern:)",
25872587
key.usr: "s:FSicFT10bitPatternSu_Si::SYNTHESIZED::s:O4cake6MyEnum",
25882588
key.original_usr: "s:FSicFT10bitPatternSu_Si",
2589-
key.doc.full_as_xml: "<Function><Name>init(bitPattern:)</Name><USR>s:FSicFT10bitPatternSu_Si</USR><Declaration>init(bitPattern: UInt)</Declaration><Abstract><Para>Construct a <codeVoice>Int</codeVoice> having the same memory representation as the <codeVoice>UInt</codeVoice> <codeVoice>bitPattern</codeVoice>. No range or overflow checking occurs, and the resulting <codeVoice>Int</codeVoice> may not have the same numeric value as <codeVoice>bitPattern</codeVoice>--it is only guaranteed to use the same pattern of bits.</Para></Abstract></Function>",
2589+
key.doc.full_as_xml: "<Function><Name>init(bitPattern:)</Name><USR>s:FSicFT10bitPatternSu_Si</USR><Declaration>init(bitPattern: UInt)</Declaration><Abstract><Para>Construct a <codeVoice>Int</codeVoice> having the same memory representation as the <codeVoice>UInt</codeVoice> <codeVoice>bitPattern</codeVoice>. No range or overflow checking occurs, and the resulting <codeVoice>Int</codeVoice> may not have the same numeric value as <codeVoice>bitPattern</codeVoice>it is only guaranteed to use the same pattern of bits.</Para></Abstract></Function>",
25902590
key.offset: 1029,
25912591
key.length: 33,
25922592
key.fully_annotated_decl: "<decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.argument_label>bitPattern</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr=\"s:Su\">UInt</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.constructor>",
@@ -2662,7 +2662,7 @@ func genfoo<T1 : Prot, T2 : cake.C1 where T1.Element == Int, T2.Element == T1.El
26622662
key.name: "init(_:radix:)",
26632663
key.usr: "s:FSicFTSS5radixSi_GSqSi_::SYNTHESIZED::s:O4cake6MyEnum",
26642664
key.original_usr: "s:FSicFTSS5radixSi_GSqSi_",
2665-
key.doc.full_as_xml: "<Function><Name>init(_:radix:)</Name><USR>s:FSicFTSS5radixSi_GSqSi_</USR><Declaration>init?(_ text: String, radix: Int = default)</Declaration><Abstract><Para>Construct from an ASCII representation in the given <codeVoice>radix</codeVoice>.</Para></Abstract><Discussion><Para>If <codeVoice>text</codeVoice> does not match the regular expression &quot;[+-]?[0-9a-zA-Z]+&quot;, or the value it denotes in the given <codeVoice>radix</codeVoice> is not representable, the result is <codeVoice>nil</codeVoice>.</Para></Discussion></Function>",
2665+
key.doc.full_as_xml: "<Function><Name>init(_:radix:)</Name><USR>s:FSicFTSS5radixSi_GSqSi_</USR><Declaration>init?(_ text: String, radix: Int = default)</Declaration><Abstract><Para>Construct from an ASCII representation in the given <codeVoice>radix</codeVoice>.</Para></Abstract><Discussion><Para>If <codeVoice>text</codeVoice> does not match the regular expression [+-]?[0-9a-zA-Z]+, or the value it denotes in the given <codeVoice>radix</codeVoice> is not representable, the result is <codeVoice>nil</codeVoice>.</Para></Discussion></Function>",
26662666
key.offset: 1149,
26672667
key.length: 49,
26682668
key.fully_annotated_decl: "<decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>?(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>text</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr=\"s:SS\">String</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>radix</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr=\"s:Si\">Int</ref.struct></decl.var.parameter.type> = <syntaxtype.keyword>default</syntaxtype.keyword></decl.var.parameter>)</decl.function.constructor>",

0 commit comments

Comments
 (0)