Unexpected symbol link source range
Closed this issue · 2 comments
arthurcro commented
Summary
When parsing a symbol link with multiline content, the source range is unexpected, new lines are replaced by whitespaces.
For instance, parsing the following symbol link:
Test of a ``multi
line symbolink``
gives a symbol link with a range of 1:11-1:35
. Which is the equivalent of:
Test of a ``multi line symbolink``
However, I would rather expect either:
- A range of
1:11-2:17
- An invalid symbol link
Steps to reproduce
let source = """
Test of a ``multi
line symbolink``
"""
let document = Document(parsing: source, options: .parseSymbolLinks)
print(document.debugDescription(options: .printEverything))
Document @1:1-2:17 Root #1 #0
└─ Paragraph @1:1-2:17 #1
├─ Text @1:1-1:11 #2 "Test of a "
└─ SymbolLink @1:11-1:35 #3 destination: multi line symbolink
Notes
This is a suspected cause of a crash in DocC diagnostic formatter. apple/swift-docc#678 (comment)
Kyle-Ye commented
Kyle-Ye commented
The issue seems to be adjust_subj_node_newlines
in inlines.c
If we comment out the following lines, the output will become expected.
if (!(options & CMARK_OPT_SOURCEPOS)) {
return;
}