Skip to content

chore: fix some comments #72088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct AliasAnalysis {
let path = SmallProjectionPath(.anyValueFields)
if let apply = inst as? ApplySite {
// Workaround for quadratic complexity in ARCSequenceOpts.
// We need to use an ever lower budget to not get into noticable compile time troubles.
// We need to use an ever lower budget to not get into noticeable compile time troubles.
let budget = complexityBudget / 10
let effect = getOwnershipEffect(of: apply, for: obj, path: path, complexityBudget: budget, context)
return effect.destroy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct EscapeUtilityTypes {
/// store %other to %2 // 4. ignore (followStores == false): %other doesn't impact the "escapeness" of %1
/// \endcode
///
/// But once the the up-walk sees a load, it has to follow stores from that point on.
/// But once the up-walk sees a load, it has to follow stores from that point on.
/// Example:
/// \code
/// bb0(%function_arg): // 7. escaping! %1 escapes through %function_arg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ struct InteriorUseWalker {
///
/// .escaping may either be a non-address operand with
/// .pointerEscape ownership, or and address operand that escapes
/// the adderss (address_to_pointer).
/// the address (address_to_pointer).
///
/// .unknown is an address operand whose user is unrecognized.
enum InteriorPointerStatus {
Expand Down
2 changes: 1 addition & 1 deletion SwiftCompilerSources/Sources/SIL/Argument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public struct ArgumentConventions : Collection, CustomStringConvertible {
/// The SIL argument index of the function type's first parameter.
public var firstParameterIndex: Int { indirectSILResultCount }

/// The SIL argument index of the 'self' paramter.
/// The SIL argument index of the 'self' parameter.
var selfIndex: Int? {
guard convention.hasSelfParameter else { return nil }
// self is the last parameter
Expand Down
2 changes: 1 addition & 1 deletion benchmark/utils/ArgParse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ArgumentParser<U> {
/// Argument holds the name of the command line parameter, its help
/// description and a rule that's applied to process it.
///
/// The the rule is typically a value processing closure used to convert it
/// The rule is typically a value processing closure used to convert it
/// into given type and storing it in the parsing result.
///
/// See also: addArgument, parseArgument
Expand Down
2 changes: 1 addition & 1 deletion docs/EmbeddedSwift/UserManual.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A typical setup and build + run cycle for an embedded development board involves
- (5) Uploading the flashable binary to the board over a USB cable using some vendor-provided JTAG/SWD tool or by copying it to a fake USB Mass Storage volume presented by the board.
- (6) Restarting the board, observing physical effects of the firmware (LEDs light up) or UART output over USB, or presence on network, etc.

Most of these steps are out of scope for this document, instead refer to the vendor provided documentation and get familiar with the details of firmware development for your board without Swift in the mix first. Even if you want to build a completely pure Swift firmware, you are still very likely going to need the the vendor provided tooling for linking, post-processing, uploading, etc.
Most of these steps are out of scope for this document, instead refer to the vendor provided documentation and get familiar with the details of firmware development for your board without Swift in the mix first. Even if you want to build a completely pure Swift firmware, you are still very likely going to need the vendor provided tooling for linking, post-processing, uploading, etc.

## Building code using Embedded Swift

Expand Down
2 changes: 1 addition & 1 deletion docs/Generics/chapters/basic-operation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ \section{Protocol Components}\label{protocol component}
\item (Check) If the worklist is empty, go to Step~8.
\item (Next) Otherwise, remove the next protocol $p$ from the worklist. If $p\in\texttt{S}$, go back to Step~2, otherwise set $\texttt{S}\leftarrow\texttt{S}\cup\{p\}$.
\item (Component) Use Algorithm~\ref{tarjan} to compute the component ID for $p$.
\item (Machine) Let $m$ be the the requirement machine for this component, creating it first if necessary. If $m\not\in\texttt{M}$, set $\texttt{M}\leftarrow\texttt{M}\cup\{m\}$.
\item (Machine) Let $m$ be the requirement machine for this component, creating it first if necessary. If $m\not\in\texttt{M}$, set $\texttt{M}\leftarrow\texttt{M}\cup\{m\}$.
\item (Successors) Add each successor of $p$ to the worklist.
\item (Loop) Go back to Step~1.
\item (Collect) Return the concatenation of the local rules from each $m\in\texttt{M}$.
Expand Down
2 changes: 1 addition & 1 deletion docs/Generics/chapters/completion.tex
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ \chapter{Completion}\label{completion}
This new kind of trie lookup can be thought of as a \index{coroutine}coroutine or an iterator, yielding zero or more results as the search proceeds. We implement it as a higher-order function taking a callback.

\begin{algorithm}[Overlap lookup in rule trie]\label{overlap trie lookup}
Takes a term $t$, position $i$ with $0\leq i<|t|$, and a callback. For each rule $u\Rightarrow v$ where $t[i:]$ is a prefix of $u$ or $u$ is a prefix of $t[i:]$, invokes the the callback with the rule $u\Rightarrow v$.
Takes a term $t$, position $i$ with $0\leq i<|t|$, and a callback. For each rule $u\Rightarrow v$ where $t[i:]$ is a prefix of $u$ or $u$ is a prefix of $t[i:]$, invokes the callback with the rule $u\Rightarrow v$.
\begin{enumerate}
\item (Initialize) Set \texttt{N} to the root node of the trie.
\item (End) If $i=|t|$, we've reached the end of the term. Perform a pre-order traversal of all child nodes of \texttt{N}, and for those children that have an associated rewrite rule, invoke the callback with that rule (this is the case where $t[i:]$ is a prefix of each $u$).
Expand Down
2 changes: 1 addition & 1 deletion docs/ReferenceGuides/UnderscoredAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ doing a textual search.

Like `@available`, this attribute indicates a decl is available only as an SPI.
This implies several behavioral changes comparing to regular `@available`:
1. Type checker diagnoses when a client accidently exposes such a symbol in library APIs.
1. Type checker diagnoses when a client accidentally exposes such a symbol in library APIs.
2. When emitting public interfaces, `@_spi_available` is printed as `@available(platform, unavailable)`.
3. ClangImporter imports ObjC macros `SPI_AVAILABLE` and `__SPI_AVAILABLE` to this attribute.

Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4716,7 +4716,7 @@ class ApplyExpr : public Expr {
/// complete type-checking.
///
/// Returns the thrown error destination, which includes both the type
/// thrown from this application as well as the the context's error type,
/// thrown from this application as well as the context's error type,
/// which may be different.
ThrownErrorDestination throws() const {
assert(Bits.ApplyExpr.ThrowsIsSet);
Expand Down
2 changes: 1 addition & 1 deletion include/swift/IRGen/IRABIDetailsProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class IRABIDetailsProvider {
SmallVector<TypeRecordABIRepresentation, 4> parameterTypes;
};

/// Returns the function signature that is used for the the type metadata
/// Returns the function signature that is used for the type metadata
/// access function.
FunctionABISignature getTypeMetadataAccessFunctionSignature();

Expand Down
2 changes: 1 addition & 1 deletion include/swift/Serialization/SerializedModuleLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct SerializedModuleBaseName {
llvm::vfs::FileSystem &fs) const;

/// Returns the .package.swiftinterface path if its package-name also applies to
/// the the importing module. Returns an empty optional otherwise.
/// the importing module. Returns an empty optional otherwise.
std::optional<std::string>
getPackageInterfacePathIfInSamePackage(llvm::vfs::FileSystem &fs,
ASTContext &ctx) const;
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ static void addNamespaceMembers(Decl *decl,
}
for (auto member : redecl->decls()) {
if (auto classTemplate = dyn_cast<clang::ClassTemplateDecl>(member)) {
// Add all specializations to a worklist so we don't accidently mutate
// Add all specializations to a worklist so we don't accidentally mutate
// the list of decls we're iterating over.
llvm::SmallPtrSet<const clang::ClassTemplateSpecializationDecl *, 16> specWorklist;
for (auto spec : classTemplate->specializations())
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ClangTypeConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ ClangTypeConverter::getClangTemplateArguments(
}
if (failedTypes.empty())
return nullptr;
// Clear "templateArgs" to prevent the clients from accidently reading a
// Clear "templateArgs" to prevent the clients from accidentally reading a
// partially converted set of template arguments.
templateArgs.clear();
auto errorInfo = std::make_unique<TemplateInstantiationError>();
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9517,7 +9517,7 @@ BraceStmt *AbstractFunctionDecl::getBody(bool canSynthesize) const {

// Don't allow getBody() to trigger parsing of an unparsed body containing the
// IDE inspection location.
// FIXME: We should be properly constructing the range of the the body as a
// FIXME: We should be properly constructing the range of the body as a
// CharSourceRange but we can't because we don't have access to the lexer
// here. Using the end location of the SourceRange works good enough here
// because the last token is a '}' and the IDE inspection point is not inside
Expand Down
2 changes: 1 addition & 1 deletion lib/Refactoring/Async/AsyncConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ bool AsyncConverter::walkToStmtPost(Stmt *S) {
if (ClosedScopeWasWrappedInContinuation &&
!Scopes.back().isWrappedInContination()) {
// The nested scope was wrapped in a continuation but the current one
// isn't anymore. Add the '}' that corresponds to the the call to
// isn't anymore. Add the '}' that corresponds to the call to
// withChecked(Throwing)Continuation.
insertCustom(S->getEndLoc(), [&]() { OS << tok::r_brace << '\n'; });
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Refactoring/Async/AsyncRefactoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ class DeclReferenceFinder : private SourceEntityWalker {
///
/// Calls to functions with an async alternative will be replaced with a call
/// to the alternative, possibly wrapped in a do/catch. The do/catch is skipped
/// if the the closure either:
/// if the closure either:
/// 1. Has no error
/// 2. Has an error but no error handling (eg. just ignores)
/// 3. Has error handling that only calls the containing function's handler
Expand Down
2 changes: 1 addition & 1 deletion lib/Refactoring/MoveMembersToExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool RefactoringActionMoveMembersToExtension::isApplicable(
case RangeKind::MultiTypeMemberDecl: {
DeclContext *DC = Info.RangeContext;

// The the common decl context is not a nomial type, we cannot create an
// The common decl context is not a nomial type, we cannot create an
// extension for it
if (!DC || !DC->getInnermostDeclarationDeclContext() ||
!isa<NominalTypeDecl>(DC->getInnermostDeclarationDeclContext()))
Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/Utils/MemAccessUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ class AccessPathDefUseTraversal {
// apply. For other storage, it is the same as accessPath.getRoot().
//
// 'base' is typically invalid, maning that all uses of 'storage' for the
// access path will be visited. When 'base' is set, the the visitor is
// access path will be visited. When 'base' is set, the visitor is
// restricted to a specific access base, such as a particular
// ref_element_addr.
SILValue base;
Expand Down
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenBackDeploy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void SILGenFunction::emitBackDeploymentThunk(SILDeclRef thunk) {
SmallVector<ManagedValue, 4> indirectErrorResults;
collectThunkParams(loc, params, &indirectParams, &indirectErrorResults);

// Build up the list of arguments that we're going to invoke the the real
// Build up the list of arguments that we're going to invoke the real
// function with.
SmallVector<SILValue, 8> paramsForForwarding;
for (auto indirectParam : indirectParams) {
Expand Down
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class LocalVariableInitialization : public SingleBufferInitialization {
// pointer to a box can be formed; and the box doesn't synchronize on
// deinit.
//
// Only add a lexical lifetime to the box if the the variable it stores
// Only add a lexical lifetime to the box if the variable it stores
// requires one.
Box = SGF.B.createBeginBorrow(
decl, Box, /*isLexical=*/lifetime.isLexical(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/// ```
///
/// The variants of SMOA form can be classified by the specific
/// mark_unresolved_non_copyable_value kind put on the the checker mark
/// mark_unresolved_non_copyable_value kind put on the checker mark
/// instruction and are as follows:
///
/// 1. no_consume_or_assign. This means that the address can only be consumed by
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Utils/CastOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ CastOptimizer::optimizeCheckedCastBranchInst(CheckedCastBranchInst *Inst) {
}
return B.createCheckedCastBranch(
dynamicCast.getLocation(), false /*isExact*/, mi,
// The cast is now from the the MetatypeInst, so get the source formal
// The cast is now from the MetatypeInst, so get the source formal
// type from it.
mi->getType().getASTType(),
dynamicCast.getTargetLoweredType(),
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/BuilderTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ ResultBuilderOpSupport TypeChecker::checkBuilderOpSupport(
continue;
}

// Check if the the candidate has a suitable availability for the
// Check if the candidate has a suitable availability for the
// calling context.
if (isUnavailable(func)) {
foundUnavailable = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/CSGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ namespace {
auto *base = expr->getChainBase();
assert(base == TypeChecker::getUnresolvedMemberChainBase(tail));

// The result type of the chain is is represented by a new type variable.
// The result type of the chain is represented by a new type variable.
auto locator = CS.getConstraintLocator(
expr, ConstraintLocator::UnresolvedMemberChainResult);
auto chainResultTy = CS.createTypeVariable(
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12086,7 +12086,7 @@ ConstraintSystem::simplifyBridgingConstraint(Type type1,
return SolutionKind::Solved;
}

// In a previous version of Swift, we could accidently drop the coercion
// In a previous version of Swift, we could accidentally drop the coercion
// constraint in certain cases. In most cases this led to either miscompiles
// or crashes later down the pipeline, but for coercions between collections
// we generated somewhat reasonable code that performed a force cast. To
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ bool IsDefaultActorRequest::evaluate(
// Any 'distributed actor' declared with availability lower than the
// introduction of custom executors for distributed actors, must be treated as default actor,
// even if it were to declared the unowned executor property, as older compilers
// do not have the the logic to handle that case.
// do not have the logic to handle that case.
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ class PotentialEffectReason {
/// argument that was not rethrows/reasync-only in this context.
ByDefaultClosure,

/// The the function is rethrows/reasync, and it was called with
/// The function is rethrows/reasync, and it was called with
/// a throwing conformance as one of its generic arguments.
ByConformance,

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/Concurrency/TaskStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace {
/// it sees that the locked bit is set in the `Status` field, it
/// must acquire the global status-record lock, find this record
/// (which should be the innermost record), and wait for an unlock if
/// the the task is not the lock owner. If it already owns the
/// the task is not the lock owner. If it already owns the
/// status record lock, it may proceed.
///
class StatusRecordLockRecord
Expand Down
2 changes: 1 addition & 1 deletion test/Macros/Inputs/syntax_macro_definitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ public struct WrapInType: PeerMacro {
}

// Build a new function with the same signature that forwards arguments
// to the the original function.
// to the original function.
let parameterList = funcDecl.signature.parameterClause.parameters
let callArguments: [String] = parameterList.map { param in
let argName = param.secondName ?? param.firstName
Expand Down
2 changes: 1 addition & 1 deletion test/SourceKit/Macros/macro_semantic_token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro anonymousTypes(_: () -> String) = #externalMacro(module: "MacroDefinition"
//##-- Prepare the macro plugin.
// RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/../../Macros/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath

// Check the output of the the `#anonymousTypes` macro
// Check the output of the `#anonymousTypes` macro
// RUN: %sourcekitd-test -req=semantic-tokens @__swiftmacro_9MacroUser33_8C2BB8A10AE555140C0EDFDEB4A9572DLl14anonymousTypesfMf_.swift -primary-file %s -- -swift-version 5 -load-plugin-library %t/%target-library-name(MacroDefinition) -module-name MacroUser %s | %FileCheck %s --check-prefix IN_BUFFER

// Check that we get some semantic tokens. Checking exact offsets is brittle.
Expand Down
2 changes: 1 addition & 1 deletion test/embedded/FixedArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func globalWithAppend() {
printit(S.a)
}

// First method to pass a FixedArray to a function: as `borrowing` paramter
// First method to pass a FixedArray to a function: as `borrowing` parameter
func printit<T: Printable>(_ a: borrowing FixedArray<T>) {
// Currently FixedArray cannot conform to Collection, yet.
// For iteration, we need to take the detour through BufferView.
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/StringWordBreaking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if #available(SwiftStdlib 5.9, *) {

// rdar://116652595
//
// We were accidently hanging when rounding word indices for some concoctions of
// We were accidentally hanging when rounding word indices for some concoctions of
// strings. In particular, where we had a pair of scalars create a constraint
// for the preceeding pair, but the preceeding extend rules were not taking the
// constraint into consideration.
Expand Down