Skip to content

Commit f2ef161

Browse files
authored
Merge pull request #2422 from ahoppen/ahoppen/fixme-cleanup
Removes TODOs and FIXMEs that are no longer applicable
2 parents 23e4c01 + 4354b33 commit f2ef161

24 files changed

+29
-82
lines changed

Sources/SwiftParser/Availability.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ extension Parser {
145145
case (.unavailable, let handle)?,
146146
(.noasync, let handle)?:
147147
let argument = self.eat(handle)
148-
// FIXME: Can we model this in SwiftSyntax by making the
149-
// 'labeled' argument part optional?
150148
entry = .token(argument)
151149
case (.star, _)?:
152150
entry = self.parseAvailabilitySpec()
@@ -177,8 +175,6 @@ extension Parser {
177175
/// Parse an availability argument.
178176
mutating func parseAvailabilitySpec() -> RawAvailabilityArgumentSyntax.Argument {
179177
if let star = self.consumeIfContextualPunctuator("*") {
180-
// FIXME: Use makeAvailabilityVersionRestriction here - but swift-format
181-
// doesn't expect it.
182178
return .token(star)
183179
}
184180

Sources/SwiftParser/Declarations.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ extension TokenConsumer {
135135
}
136136

137137
// Otherwise, parse it as an expression.
138-
// FIXME: C++ parser returns true if this is a top-level non-"script" files.
139-
// But we don't have "is library" flag.
140138
return false
141139
case .some(_):
142140
// All other decl start keywords unconditionally start a decl.
@@ -1670,8 +1668,10 @@ extension Parser {
16701668
let (unexpectedBeforeIdentifier, identifier) = self.expectIdentifier(allowSelfOrCapitalSelfAsIdentifier: true)
16711669
var types = [RawDesignatedTypeSyntax]()
16721670
while let comma = self.consume(if: .comma) {
1673-
// FIXME: The compiler accepts... anything here. This is a bug.
1674-
// let (unexpectedBeforeDesignatedType, designatedType) = self.expectIdentifier()
1671+
// Technically, we should only accept identifiers for the designated
1672+
// types but the C++ parser accepted anything, which we mimick.
1673+
// It's not worth fixing since designated types are no longer allowed
1674+
// anyway.
16751675
let designatedType = self.consumeAnyToken()
16761676
types.append(
16771677
RawDesignatedTypeSyntax(

Sources/SwiftParser/Expressions.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ extension Parser {
791791

792792
// Check for a trailing closure, if allowed.
793793
if self.at(.leftBrace) && !leadingExpr.raw.kind.isLiteral && self.withLookahead({ $0.atValidTrailingClosure(flavor: flavor) }) {
794-
// FIXME: if Result has a trailing closure, break out.
795794
// Add dummy blank argument list to the call expression syntax.
796795
let list = RawLabeledExprListSyntax(elements: [], arena: self.arena)
797796
let (first, rest) = self.parseTrailingClosures(flavor: flavor)
@@ -1472,7 +1471,6 @@ extension Parser {
14721471
}
14731472

14741473
if let (colon, rsquare) = self.consume(if: .colon, followedBy: .rightSquare) {
1475-
// FIXME: We probably want a separate node for the empty case.
14761474
return RawExprSyntax(
14771475
RawDictionaryExprSyntax(
14781476
unexpectedBeforeLSquare,

Sources/SwiftParser/TopLevel.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ extension Parser {
150150
)
151151
}
152152

153-
// FIXME: It is unfortunate that the Swift book refers to these as
154-
// "statements" and not "items".
155153
let item = self.parseItem(isAtTopLevel: isAtTopLevel, allowInitDecl: allowInitDecl)
156154
let semi = self.consume(if: .semicolon)
157155
var trailingSemis: [RawTokenSyntax] = []

Sources/SwiftParser/Types.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ extension Parser {
380380
/// Parse a type placeholder.
381381
mutating func parsePlaceholderType() -> RawIdentifierTypeSyntax {
382382
let (unexpectedBeforeName, name) = self.expect(.wildcard)
383-
// FIXME: Need a better syntax node than this
384383
return RawIdentifierTypeSyntax(
385384
unexpectedBeforeName,
386385
name: name,

Sources/SwiftParserDiagnostics/MissingTokenError.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ extension ParseDiagnosticsGenerator {
4949
private func handleInvalidIdentifier(invalidToken: TokenSyntax, missingToken: TokenSyntax, invalidTokenContainer: UnexpectedNodesSyntax) -> Bool {
5050
let fixIts: [FixIt]
5151
if invalidToken.tokenKind.isLexerClassifiedKeyword || invalidToken.tokenKind.isDollarIdentifier {
52-
// TODO: Should the parser add the text with backticks to the missing
53-
// node? Then this could just make missing/present.
5452
fixIts = [
5553
FixIt(
5654
message: .wrapInBackticks,

Sources/SwiftParserDiagnostics/MultiLineStringLiteralDiagnosticsGenerator.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ final class MultiLineStringLiteralIndentationDiagnosticsGenerator: SyntaxVisitor
133133
case .stringSegment(let stringSegment):
134134
return stringSegment.last?.isNewline ?? false
135135
default:
136-
// FIXME: newlines should never be part of trailing trivia
137136
return previousToken.trailingTrivia.contains(where: { $0.isNewline })
138137
}
139138
}

Sources/SwiftSyntax/Raw/RawSyntaxNodeProtocol.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ public struct RawTokenSyntax: RawSyntaxNodeProtocol {
270270
trailingTriviaPieces: [RawTriviaPiece] = [],
271271
arena: __shared SyntaxArena
272272
) {
273-
// FIXME: Allow creating a `RawSyntax.parsedToken()` with a string literal
274-
// for text. Currently it asserts that the string buffer is not contained
275-
// within the `arena`.
276273
self.init(
277274
materialized: kind,
278275
text: text ?? kind.defaultText ?? "",

Sources/SwiftSyntax/SyntaxChildren.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ struct RawSyntaxChildren: BidirectionalCollection {
153153

154154
/// The rootId of the tree the child nodes belong to
155155
private let rootId: UInt
156+
156157
/// The number of children in `parent`. Cached to avoid reaching into `parent` for every index
157158
/// advancement
158-
// FIXME: Do we need this cached?
159159
private let numberOfChildren: Int
160160

161161
let startIndex: SyntaxChildrenIndex

Sources/SwiftSyntaxBuilder/Syntax+StringInterpolation.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ extension String: ExpressibleByLiteralSyntax {
268268

269269
extension ExpressibleByLiteralSyntax where Self: BinaryInteger {
270270
public func makeLiteralSyntax() -> IntegerLiteralExprSyntax {
271-
// TODO: Radix selection? Thousands separators?
272271
let digits = String(self, radix: 10)
273272
return IntegerLiteralExprSyntax(literal: .integerLiteral(digits))
274273
}
@@ -305,7 +304,6 @@ extension ExpressibleByLiteralSyntax where Self: FloatingPoint, Self: LosslessSt
305304
)
306305

307306
case .negativeNormal, .negativeSubnormal, .positiveZero, .positiveSubnormal, .positiveNormal:
308-
// TODO: Thousands separators?
309307
let digits = String(self)
310308
return ExprSyntax(FloatLiteralExprSyntax(literal: .floatLiteral(digits)))
311309
}

0 commit comments

Comments
 (0)