Skip to content

Commit f189720

Browse files
committed
Update calls to deprecated diagnostic properties
1 parent acf6cd5 commit f189720

15 files changed

+65
-65
lines changed

Sources/SwiftDocCUtilities/Action/Actions/Convert/ConvertFileWritingConsumer.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ private extension Digest.Diagnostic {
253253
self.start = (diagnostic.range?.lowerBound).map { Location(line: $0.line, column: $0.column) }
254254
self.source = rootURL.flatMap { diagnostic.source?.relative(to: $0) }
255255
self.severity = diagnostic.severity
256-
self.summary = diagnostic.localizedSummary
257-
self.explanation = diagnostic.localizedExplanation
256+
self.summary = diagnostic.summary
257+
self.explanation = diagnostic.explanation
258258
self.notes = diagnostic.notes.map {
259259
Note(location: Location(line: $0.range.lowerBound.line, column: $0.range.lowerBound.column), message: $0.message)
260260
}

Tests/SwiftDocCTests/Diagnostics/DiagnosticTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class DiagnosticTests: XCTestCase {
2222
func testLocalizedSummary() {
2323
let expectedDump = "This is a test diagnostic"
2424

25-
XCTAssertEqual(expectedDump, basicDiagnostic.localizedSummary)
25+
XCTAssertEqual(expectedDump, basicDiagnostic.summary)
2626
}
2727

2828
func testLocalizedExplanation() {
29-
XCTAssertNil(nonexistentDiagnostic.localizedExplanation)
30-
guard let explanation = basicDiagnostic.localizedExplanation else {
31-
XCTFail("basicDiagnostic.localizedExplanation was nil.")
29+
XCTAssertNil(nonexistentDiagnostic.explanation)
30+
guard let explanation = basicDiagnostic.explanation else {
31+
XCTFail("basicDiagnostic.explanation was nil.")
3232
return
3333
}
3434
let expectedDump = """

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContextTests.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ class DocumentationContextTests: XCTestCase {
649649

650650
XCTAssertEqual(problemWithDuplicate.count, 1)
651651

652-
let localizedSummary = try XCTUnwrap(problemWithDuplicate.first?.diagnostic.localizedSummary)
652+
let localizedSummary = try XCTUnwrap(problemWithDuplicate.first?.diagnostic.summary)
653653
XCTAssertEqual(localizedSummary, "Redeclaration of 'TestTutorial.tutorial'; this file will be skipped")
654654

655655
}
@@ -661,10 +661,10 @@ class DocumentationContextTests: XCTestCase {
661661

662662
XCTAssertEqual(problemWithDuplicateReference.count, 2)
663663

664-
let localizedSummary = try XCTUnwrap(problemWithDuplicateReference.first?.diagnostic.localizedSummary)
664+
let localizedSummary = try XCTUnwrap(problemWithDuplicateReference.first?.diagnostic.summary)
665665
XCTAssertEqual(localizedSummary, "Redeclaration of \'overview.md\'; this file will be skipped")
666666

667-
let localizedSummarySecond = try XCTUnwrap(problemWithDuplicateReference[1].diagnostic.localizedSummary)
667+
let localizedSummarySecond = try XCTUnwrap(problemWithDuplicateReference[1].diagnostic.summary)
668668
XCTAssertEqual(localizedSummarySecond, "Redeclaration of \'overview.md\'; this file will be skipped")
669669
}
670670

@@ -1172,12 +1172,12 @@ class DocumentationContextTests: XCTestCase {
11721172
XCTAssertNotNil(context.problems
11731173
.map { $0.diagnostic }
11741174
.filter { $0.identifier == "org.swift.docc.DuplicateMarkdownTitleSymbolReferences"
1175-
&& $0.localizedSummary.contains("'/mykit'") }
1175+
&& $0.summary.contains("'/mykit'") }
11761176
)
11771177
XCTAssertNotNil(context.problems
11781178
.map { $0.diagnostic }
11791179
.filter { $0.identifier == "org.swift.docc.DuplicateMarkdownTitleSymbolReferences"
1180-
&& $0.localizedSummary.contains("'/myprotocol'") }
1180+
&& $0.summary.contains("'/myprotocol'") }
11811181
)
11821182
}
11831183

@@ -1760,7 +1760,7 @@ let expected = """
17601760
if let unmatchedSidecarDiagnostic = unmatchedSidecarProblem?.diagnostic {
17611761
XCTAssertTrue(sidecarFilesForUnknownSymbol.contains(unmatchedSidecarDiagnostic.source?.standardizedFileURL), "One of the files should be the diagnostic source")
17621762
XCTAssertEqual(unmatchedSidecarDiagnostic.range, SourceLocation(line: 1, column: 3, source: unmatchedSidecarProblem?.diagnostic.source)..<SourceLocation(line: 1, column: 26, source: unmatchedSidecarProblem?.diagnostic.source))
1763-
XCTAssertEqual(unmatchedSidecarDiagnostic.localizedSummary, "No symbol matched 'MyKit/UnknownSymbol'. This documentation will be ignored.")
1763+
XCTAssertEqual(unmatchedSidecarDiagnostic.summary, "No symbol matched 'MyKit/UnknownSymbol'. This documentation will be ignored.")
17641764
XCTAssertEqual(unmatchedSidecarDiagnostic.severity, .information)
17651765

17661766
XCTAssertEqual(unmatchedSidecarDiagnostic.notes.count, 1)
@@ -1791,7 +1791,7 @@ let expected = """
17911791
let curationDiagnostics = context.problems.filter({ $0.diagnostic.identifier == "org.swift.docc.ArticleUncurated" }).map(\.diagnostic)
17921792
let sidecarDiagnostic = try XCTUnwrap(curationDiagnostics.first(where: { $0.source?.standardizedFileURL == unknownSymbolSidecarURL.standardizedFileURL }))
17931793
XCTAssertNil(sidecarDiagnostic.range)
1794-
XCTAssertEqual(sidecarDiagnostic.localizedSummary, "You haven't curated 'doc://org.swift.docc.example/documentation/Test-Bundle/UncuratedArticle'")
1794+
XCTAssertEqual(sidecarDiagnostic.summary, "You haven't curated 'doc://org.swift.docc.example/documentation/Test-Bundle/UncuratedArticle'")
17951795
XCTAssertEqual(sidecarDiagnostic.severity, .information)
17961796
}
17971797

@@ -2573,7 +2573,7 @@ let expected = """
25732573
let identifier = "org.swift.docc.DuplicateMarkdownTitleSymbolReferences"
25742574
let duplicateMarkdownProblems = context.problems.filter({ $0.diagnostic.identifier == identifier })
25752575
XCTAssertEqual(duplicateMarkdownProblems.count, 2)
2576-
XCTAssertEqual(duplicateMarkdownProblems.first?.diagnostic.localizedSummary, "Multiple occurrences of \'/documentation/MyKit/MyClass/myFunction()\' found")
2576+
XCTAssertEqual(duplicateMarkdownProblems.first?.diagnostic.summary, "Multiple occurrences of \'/documentation/MyKit/MyClass/myFunction()\' found")
25772577
}
25782578

25792579
/// This test verifies that collision nodes and children of collision nodes are correctly

Tests/SwiftDocCTests/Infrastructure/DocumentationCuratorTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class DocumentationCuratorTests: XCTestCase {
128128
SourceLocation(line: 12, column: 4, source: moduleCurationProblem?.diagnostic.source)..<SourceLocation(line: 12, column: 13, source: moduleCurationProblem?.diagnostic.source)
129129
)
130130
XCTAssertEqual(
131-
moduleCurationProblem?.diagnostic.localizedSummary,
131+
moduleCurationProblem?.diagnostic.summary,
132132
"Linking to \'doc://org.swift.docc.example/documentation/MyKit\' from a Topics group in \'doc://org.swift.docc.example/documentation/MyKit/MyClass/myFunction()\' isn't allowed"
133133
)
134134

@@ -140,7 +140,7 @@ class DocumentationCuratorTests: XCTestCase {
140140
SourceLocation(line: 13, column: 4, source: moduleCurationProblem?.diagnostic.source)..<SourceLocation(line: 13, column: 20, source: moduleCurationProblem?.diagnostic.source)
141141
)
142142
XCTAssertEqual(
143-
cyclicReferenceProblem?.diagnostic.localizedSummary,
143+
cyclicReferenceProblem?.diagnostic.summary,
144144
"A symbol can't link to itself from within its Topics group in \'doc://org.swift.docc.example/documentation/MyKit/MyClass/myFunction()\'"
145145
)
146146
}

Tests/SwiftDocCTests/Infrastructure/ExternalReferenceResolverTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ Document @1:1-1:35
775775
TopicReferenceResolutionResult.success(ResolvedTopicReference(bundleIdentifier: "com.external.testbundle", path: "/resolved", fragment: nil, sourceLanguage: .swift))
776776
)
777777

778-
XCTAssert(context.problems.contains(where: { $0.diagnostic.localizedSummary.contains("Unit test: External resolve error.")}),
778+
XCTAssert(context.problems.contains(where: { $0.diagnostic.summary.contains("Unit test: External resolve error.")}),
779779
"The external reference resolver error message is included in that problem's error summary.")
780780

781781
// Get MyKit symbol

Tests/SwiftDocCTests/Infrastructure/ReferenceResolverTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class ReferenceResolverTests: XCTestCase {
338338

339339
let diagnostics = context.problems.filter({ $0.diagnostic.source?.standardizedFileURL == uncuratedArticleFile.standardizedFileURL }).map(\.diagnostic)
340340
let diagnostic = try XCTUnwrap(diagnostics.first(where: { $0.identifier == "org.swift.docc.ArticleUncurated" }))
341-
XCTAssertEqual(diagnostic.localizedSummary, "You haven't curated 'doc://org.swift.docc.example/documentation/Test-Bundle/UncuratedArticle'")
341+
XCTAssertEqual(diagnostic.summary, "You haven't curated 'doc://org.swift.docc.example/documentation/Test-Bundle/UncuratedArticle'")
342342

343343
let referencingFileDiagnostics = context.problems.map(\.diagnostic).filter({ $0.source?.standardizedFileURL == referencingArticleURL.standardizedFileURL })
344344
XCTAssertEqual(referencingFileDiagnostics.filter({ $0.identifier == "org.swift.docc.unresolvedTopicReference" }).count, 1)

Tests/SwiftDocCTests/Model/SemaToRenderNodeTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ Document
19511951
XCTAssertNotNil(context.problems.first(where: { problem -> Bool in
19521952

19531953
return problem.diagnostic.identifier == "org.swift.docc.InvalidDocumentationLink"
1954-
&& problem.diagnostic.localizedSummary.contains("https://external.com/link")
1954+
&& problem.diagnostic.summary.contains("https://external.com/link")
19551955
}))
19561956
}
19571957

@@ -2696,7 +2696,7 @@ Document
26962696
return p.diagnostic.identifier == "org.swift.docc.unresolvedResource"
26972697
}
26982698
XCTAssertFalse(missingResources.contains(where: { p -> Bool in
2699-
return p.diagnostic.localizedSummary == "Resource 'my-inherited-image.png' couldn't be found"
2699+
return p.diagnostic.summary == "Resource 'my-inherited-image.png' couldn't be found"
27002700
}))
27012701

27022702
let myFuncReference = ResolvedTopicReference(bundleIdentifier: bundle.identifier, path: "/documentation/SideKit/SideClass/Element/inherited()", sourceLanguage: .swift)
@@ -2899,7 +2899,7 @@ Document
28992899

29002900
// Verify that we don't reference resolve inherited docs.
29012901
XCTAssertFalse(context.diagnosticEngine.problems.contains(where: { problem in
2902-
problem.diagnostic.localizedSummary.contains("my-inherited-image.png")
2902+
problem.diagnostic.summary.contains("my-inherited-image.png")
29032903
}))
29042904

29052905
let myFuncReference = ResolvedTopicReference(bundleIdentifier: bundle.identifier, path: "/documentation/SideKit/SideClass/Element/inherited()", sourceLanguage: .swift)

Tests/SwiftDocCTests/Semantics/General Purpose Analyses/HasOnlySequentialHeadingsTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ some more *stuff*
7070
var problems: [Problem] = []
7171
Semantic.Analyses.HasOnlySequentialHeadings<TutorialArticle>(severityIfFound: .warning, startingFromLevel: 2).analyze(containerDirective, children: document.children, source: nil, for: bundle, in: context, problems: &problems)
7272

73-
XCTAssertEqual(problems.map { $0.diagnostic.localizedSummary },
73+
XCTAssertEqual(problems.map { $0.diagnostic.summary },
7474
[
7575
"This heading doesn't meet or exceed the minimum allowed heading level (2)",
7676
"This heading doesn't meet or exceed the minimum allowed heading level (2)",
@@ -91,7 +91,7 @@ some more *stuff*
9191
var problems: [Problem] = []
9292
Semantic.Analyses.HasOnlySequentialHeadings<TutorialArticle>(severityIfFound: .warning, startingFromLevel: 2).analyze(containerDirective, children: document.children, source: nil, for: bundle, in: context, problems: &problems)
9393

94-
XCTAssertEqual(problems.map { $0.diagnostic.localizedSummary },
94+
XCTAssertEqual(problems.map { $0.diagnostic.summary },
9595
[
9696
"This heading doesn't sequentially follow the previous heading",
9797
"This heading doesn't sequentially follow the previous heading",

Tests/SwiftDocCTests/Semantics/MetadataTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class MetadataTests: XCTestCase {
126126
var problems = [Problem]()
127127
let metadata = Metadata(from: directive, source: nil, for: bundle, in: context, problems: &problems)
128128
XCTAssertNotNil(metadata)
129-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
129+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
130130

131131
XCTAssertEqual(metadata?.displayName?.name, "Custom Name")
132132
}
@@ -165,7 +165,7 @@ class MetadataTests: XCTestCase {
165165
var problems = [Problem]()
166166
let article = Article(from: document, source: nil, for: bundle, in: context, problems: &problems)
167167
XCTAssertNotNil(article, "An Article value can be created with a Metadata child.")
168-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
168+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
169169

170170
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
171171
_ = analyzer.visit(document)
@@ -189,7 +189,7 @@ class MetadataTests: XCTestCase {
189189
XCTAssertNotNil(article, "An Article value can be created with a Metadata child with a DisplayName child.")
190190
XCTAssertNotNil(article?.metadata?.displayName, "The Article has the parsed DisplayName metadata.")
191191

192-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
192+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
193193

194194
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
195195
_ = analyzer.visit(document)
@@ -218,7 +218,7 @@ class MetadataTests: XCTestCase {
218218
let problem = try XCTUnwrap(problems.first)
219219

220220
XCTAssertEqual(problem.diagnostic.identifier, "org.swift.docc.Article.DisplayName.NotSupported")
221-
XCTAssertEqual(problem.diagnostic.localizedSummary, "A 'DisplayName' directive is only supported in documentation extension files. To customize the display name of an article, change the content of the level-1 heading.")
221+
XCTAssertEqual(problem.diagnostic.summary, "A 'DisplayName' directive is only supported in documentation extension files. To customize the display name of an article, change the content of the level-1 heading.")
222222

223223
XCTAssertEqual(problem.possibleSolutions.count, 1)
224224
let solution = try XCTUnwrap(problem.possibleSolutions.first)

Tests/SwiftDocCTests/Semantics/RedirectedTests.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class RedirectedTests: XCTestCase {
5858
XCTAssertEqual(1, problems.count)
5959
XCTAssertEqual(problems.first?.diagnostic.identifier, "org.swift.docc.HasArgument.from.ConversionFailed")
6060
XCTAssertEqual(
61-
problems.first?.diagnostic.localizedSummary,
61+
problems.first?.diagnostic.summary,
6262
"Cannot convert '\(pathWithInvalidCharacter)' to type 'URL'"
6363
)
6464
}
@@ -134,7 +134,7 @@ class RedirectedTests: XCTestCase {
134134
var problems = [Problem]()
135135
let technology = Technology(from: directive, source: nil, for: bundle, in: context, problems: &problems)
136136
XCTAssertNotNil(technology, "A Technology value can be created with a Redirected child.")
137-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
137+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
138138

139139
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
140140
_ = analyzer.visit(document)
@@ -166,7 +166,7 @@ class RedirectedTests: XCTestCase {
166166
var problems = [Problem]()
167167
let volume = Volume(from: directive, source: nil, for: bundle, in: context, problems: &problems)
168168
XCTAssertNotNil(volume, "A Volume value can be created with a Redirected child.")
169-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
169+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
170170
}
171171

172172
func testTutorialAndSectionsSupportsRedirect() throws {
@@ -231,7 +231,7 @@ class RedirectedTests: XCTestCase {
231231
var problems = [Problem]()
232232
let tutorial = Tutorial(from: directive, source: nil, for: bundle, in: context, problems: &problems)
233233
XCTAssertNotNil(tutorial, "A Tutorial value can be created with a Redirected child.")
234-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
234+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
235235

236236
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
237237
_ = analyzer.visit(document)
@@ -259,7 +259,7 @@ class RedirectedTests: XCTestCase {
259259
var problems = [Problem]()
260260
let article = TutorialArticle(from: directive, source: nil, for: bundle, in: context, problems: &problems)
261261
XCTAssertNotNil(article, "A TutorialArticle value can be created with a Redirected child.")
262-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
262+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
263263

264264
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
265265
_ = analyzer.visit(document)
@@ -308,7 +308,7 @@ class RedirectedTests: XCTestCase {
308308
var problems = [Problem]()
309309
let article = Resources(from: directive, source: nil, for: bundle, in: context, problems: &problems)
310310
XCTAssertNotNil(article, "A Resources value can be created with a Redirected child.")
311-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
311+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
312312
}
313313

314314
func testArticleSupportsRedirect() throws {
@@ -329,7 +329,7 @@ class RedirectedTests: XCTestCase {
329329
var problems = [Problem]()
330330
let article = Article(from: document, source: nil, for: bundle, in: context, problems: &problems)
331331
XCTAssertNotNil(article, "An Article value can be created with a Redirected child.")
332-
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.localizedSummary })")
332+
XCTAssert(problems.isEmpty, "There shouldn't be any problems. Got:\n\(problems.map { $0.diagnostic.summary })")
333333

334334
var analyzer = SemanticAnalyzer(source: nil, context: context, bundle: bundle)
335335
_ = analyzer.visit(document)

0 commit comments

Comments
 (0)