From 7ea09a9032f58570655f4b1d19fcd4b0504f8c25 Mon Sep 17 00:00:00 2001 From: Alex Binary Date: Sun, 24 May 2020 10:59:47 +0200 Subject: [PATCH 1/2] Fix comments on `_compactMap(_:)` --- stdlib/public/core/SequenceAlgorithms.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/public/core/SequenceAlgorithms.swift b/stdlib/public/core/SequenceAlgorithms.swift index 7b1e8f263e734..0af14d64144fa 100644 --- a/stdlib/public/core/SequenceAlgorithms.swift +++ b/stdlib/public/core/SequenceAlgorithms.swift @@ -794,8 +794,8 @@ extension Sequence { return try _compactMap(transform) } - // The implementation of flatMap accepting a closure with an optional result. - // Factored out into a separate functions in order to be used in multiple + // The implementation of compactMap accepting a closure with an optional result. + // Factored out into a separate function in order to be used in multiple // overloads. @inlinable // protocol-only @inline(__always) From dac96989a4e8785c7848c302667a1ce4d0a0b485 Mon Sep 17 00:00:00 2001 From: Owen Voorhees Date: Tue, 26 May 2020 08:02:33 -0700 Subject: [PATCH 2/2] Fix comparisons between presumed and buffer line numbers --- lib/Parse/ParseStmt.cpp | 4 ++-- lib/Sema/MiscDiagnostics.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 7bdb112cd1993..67b02a28ceeb8 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -771,8 +771,8 @@ ParserResult Parser::parseStmtReturn(SourceLoc tryLoc) { // Issue a warning when the returned expression is on a different line than // the return keyword, but both have the same indentation. - if (SourceMgr.getPresumedLineAndColumnForLoc(ReturnLoc).second == - SourceMgr.getPresumedLineAndColumnForLoc(ExprLoc).second) { + if (SourceMgr.getLineAndColumnInBuffer(ReturnLoc).second == + SourceMgr.getLineAndColumnInBuffer(ExprLoc).second) { diagnose(ExprLoc, diag::unindented_code_after_return); diagnose(ExprLoc, diag::indent_expression_to_silence); } diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index 4f6faa96c55b2..8d5b52db5b505 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -3163,7 +3163,7 @@ static void checkSwitch(ASTContext &ctx, const SwitchStmt *stmt) { continue; auto &SM = ctx.SourceMgr; - auto prevLineCol = SM.getPresumedLineAndColumnForLoc(prevLoc); + auto prevLineCol = SM.getLineAndColumnInBuffer(prevLoc); if (SM.getLineAndColumnInBuffer(thisLoc).first != prevLineCol.first) continue;