Skip to content

Commit 879f5f2

Browse files
nmcc24MatyasKriz
authored andcommitted
Address compilation warnings
Resolving multiple compilation warnings, from deprecations to implicit casting
1 parent fad35de commit 879f5f2

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

Generator/Sources/CLI/Glob.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ final class Glob: Collection {
153153
let includeDirectories = behavior.includesDirectoriesInResults
154154

155155
for i in 0..<Int(gt.gl_matchc) {
156-
if let path = String(validatingUTF8: gt.gl_pathv[i]!) {
156+
if let path = String(validatingCString: gt.gl_pathv[i]!) {
157157
if !includeFiles || !includeDirectories {
158158
let isDirectory = self.isDirectory(path: path)
159159
if (!includeFiles && !isDirectory) || (!includeDirectories && isDirectory) {

Generator/Sources/Internal/GeneratorHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct GeneratorHelper {
7676
private static func openNestedClosure(for method: Method) -> String {
7777
var fullString = ""
7878
for (index, parameter) in method.signature.parameters.enumerated() {
79-
if !parameter.type.containsAttribute(named: "@escaping"), let closure = parameter.type.findClosure() {
79+
if !parameter.type.containsAttribute(named: "@escaping"), parameter.type.findClosure() != nil {
8080
if fullString.isEmpty {
8181
fullString = "\n"
8282
}

Generator/Sources/Internal/Helpers/SwiftSyntax+convenience.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extension SyntaxProtocol {
4444
)
4545
)
4646
}
47-
return identifierType.as(Self.self)!
47+
return Self.init(identifierType) ?? mutableSelf
4848
} else {
4949
return mutableSelf
5050
}

Generator/Sources/Internal/Tokens/Capabilities/HasGenerics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ extension HasGenerics {
5050
"genericArguments": genericArgumentsString,
5151
"hasPrimaryAssociatedTypes": hasPrimaryAssociatedTypes,
5252
"hasOnlyPrimaryAssociatedTypes": hasOnlyPrimaryAssociatedTypes,
53-
"genericProtocolIdentity": genericProtocolIdentity,
54-
"genericPrimaryAssociatedTypeArguments": genericPrimaryAssociatedTypeArguments,
53+
"genericProtocolIdentity": genericProtocolIdentity as Any,
54+
"genericPrimaryAssociatedTypeArguments": genericPrimaryAssociatedTypeArguments as Any,
5555
]
5656
.compactMapValues { $0 }
5757
}

Generator/Sources/Internal/Tokens/ComplexType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum ComplexType {
2020
self = .attributed(
2121
attributes: [
2222
attributedType.attributes.map { $0.trimmedDescription },
23-
attributedType.specifier.map { [$0.trimmedDescription] } ?? [],
23+
attributedType.specifiers.map { $0.trimmedDescription },
2424
].flatMap { $0 },
2525
baseType: ComplexType(syntax: attributedType.baseType)
2626
)

0 commit comments

Comments
 (0)