Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Basic/StringConversions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public extension String {
}

// Otherwise iterate and escape all the single quotes.
var newString = "'" + String(utf8[utf8.startIndex..<singleQuotePos])
var newString = "'" + String(utf8[utf8.startIndex..<singleQuotePos])!

for char in utf8[singleQuotePos..<utf8.endIndex] {
if char == UInt8(ascii: "'") {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Basic/TOML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private struct Lexer {
break
}
}
return .stringLiteral(value: String(utf8[utf8.index(after: startIndex)..<endIndex]))
return .stringLiteral(value: String(utf8[utf8.index(after: startIndex)..<endIndex])!)

// Numeric literals.
//
Expand All @@ -279,7 +279,7 @@ private struct Lexer {
while let c = look(), c.isNumberChar() {
let _ = eat()
}
return .number(value: String(utf8[startIndex..<index]))
return .number(value: String(utf8[startIndex..<index])!)

// Identifiers.
case let c where c.isIdentifierChar():
Expand All @@ -289,7 +289,7 @@ private struct Lexer {
}

// Match special strings.
let value: String = String(utf8[startIndex..<index])
let value: String = String(utf8[startIndex..<index])!
switch value {
case "true":
return .boolean(value: true)
Expand Down Expand Up @@ -761,5 +761,5 @@ public extension TOMLItem {
/// returns: A list of the lexed tokens' string representations.
internal func lexTOML(_ data: String) -> [String] {
let lexer = Lexer(data)
return lexer.map { String($0) }
return lexer.map { String(describing: $0) }
Copy link
Contributor Author

@CodaFi CodaFi Jul 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I flatten this as

lexer.map(String.init(describing:))

}
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/ConventionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ final class PackageBuilderTester {
// FIXME: Find a better way. Maybe Package can keep array of warnings.
uncheckedDiagnostics = Set(warningStream.bytes.asReadableString.characters.split(separator: "\n").map(String.init))
} catch {
let errorStr = String(error)
let errorStr = String(describing: error)
result = .error(errorStr)
uncheckedDiagnostics.insert(errorStr)
}
Expand Down