mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix some typos in the codebase
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Code of Conduct
|
# Code of Conduct
|
||||||
|
|
||||||
The code of conduct for this project can be found at https://swift.org/code-of-conduct.
|
The code of conduct for this project can be found at https://swift.org/code-of-conduct/.
|
||||||
|
|
||||||
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
|
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ let computeSideEffects = FunctionPass(name: "compute-side-effects") {
|
|||||||
// global effects to the argument, because we don't know to which "global" side-effect
|
// global effects to the argument, because we don't know to which "global" side-effect
|
||||||
// instruction the argument might have escaped.
|
// instruction the argument might have escaped.
|
||||||
for argument in function.arguments {
|
for argument in function.arguments {
|
||||||
collectedEffects.addEffectsForEcapingArgument(argument: argument)
|
collectedEffects.addEffectsForEscapingArgument(argument: argument)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't modify the effects if they didn't change. This avoids sending a change notification
|
// Don't modify the effects if they didn't change. This avoids sending a change notification
|
||||||
@@ -214,7 +214,7 @@ private struct CollectedEffects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutating func addEffectsForEcapingArgument(argument: FunctionArgument) {
|
mutating func addEffectsForEscapingArgument(argument: FunctionArgument) {
|
||||||
var escapeWalker = ArgumentEscapingWalker()
|
var escapeWalker = ArgumentEscapingWalker()
|
||||||
|
|
||||||
if escapeWalker.hasUnknownUses(argument: argument) {
|
if escapeWalker.hasUnknownUses(argument: argument) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ private func inlineAndDevirtualize(apply: FullApplySite, alreadyInlinedFunctions
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !context.loadFunction(function: callee, loadCalleesRecursively: true) {
|
if !context.loadFunction(function: callee, loadCalleesRecursively: true) {
|
||||||
// We don't have the funcion body of the callee.
|
// We don't have the function body of the callee.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public func run_AngryPhonebook(_ n: Int) {
|
|||||||
// To keep the performance of various scripts roughly comparable, aim for
|
// To keep the performance of various scripts roughly comparable, aim for
|
||||||
// a total length of approximately 120 characters.
|
// a total length of approximately 120 characters.
|
||||||
// E.g.: `ascii.joined(separator: "").count == 124`
|
// E.g.: `ascii.joined(separator: "").count == 124`
|
||||||
// Every name should fit in 15-bytes UTF-8 encoded, to excercise the small
|
// Every name should fit in 15-bytes UTF-8 encoded, to exercise the small
|
||||||
// string optimization.
|
// string optimization.
|
||||||
// E.g.: `armenian.allSatisfy { $0._guts.isSmall } == true`
|
// E.g.: `armenian.allSatisfy { $0._guts.isSmall } == true`
|
||||||
|
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ enum value will abort the program.
|
|||||||
### Resilient Enums
|
### Resilient Enums
|
||||||
|
|
||||||
A resilient Swift enumeration value could represent a case that's unknown to the client.
|
A resilient Swift enumeration value could represent a case that's unknown to the client.
|
||||||
Swift forces the client to check if the value is `@uknown default` when switching over
|
Swift forces the client to check if the value is `@unknown default` when switching over
|
||||||
the enumeration to account for that. C++ follows a similar principle,
|
the enumeration to account for that. C++ follows a similar principle,
|
||||||
by exposing an `unknownDefault` case that can then be matched in a switch.
|
by exposing an `unknownDefault` case that can then be matched in a switch.
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ extension ObservableMacro: MemberAttributeMacro {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
// dont apply to ignored properties or properties that are already flaged as tracked
|
// dont apply to ignored properties or properties that are already flagged as tracked
|
||||||
if property.hasMacroApplication(ObservableMacro.ignoredMacroName) ||
|
if property.hasMacroApplication(ObservableMacro.ignoredMacroName) ||
|
||||||
property.hasMacroApplication(ObservableMacro.trackedMacroName) {
|
property.hasMacroApplication(ObservableMacro.trackedMacroName) {
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -1403,7 +1403,7 @@ bool RefactoringActionExtractFunction::performChange() {
|
|||||||
// Correct the given name if collision happens.
|
// Correct the given name if collision happens.
|
||||||
PreferredName = correctNewDeclName(InsertToDC, PreferredName);
|
PreferredName = correctNewDeclName(InsertToDC, PreferredName);
|
||||||
|
|
||||||
// Collect the paramters to pass down to the new function.
|
// Collect the parameters to pass down to the new function.
|
||||||
std::vector<ReferencedDecl> Parameters;
|
std::vector<ReferencedDecl> Parameters;
|
||||||
for (auto &RD: RangeInfo.ReferencedDecls) {
|
for (auto &RD: RangeInfo.ReferencedDecls) {
|
||||||
// If the referenced decl is declared elsewhere, no need to pass as parameter
|
// If the referenced decl is declared elsewhere, no need to pass as parameter
|
||||||
|
|||||||
@@ -3381,7 +3381,7 @@ private:
|
|||||||
loweredSubstParamType, origParamType, paramSlice))
|
loweredSubstParamType, origParamType, paramSlice))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If we have a guaranteed paramter, see if we have a move only type and
|
// If we have a guaranteed parameter, see if we have a move only type and
|
||||||
// can emit it borrow.
|
// can emit it borrow.
|
||||||
//
|
//
|
||||||
// We check for move only in tryEmitBorrowedMoveOnly.
|
// We check for move only in tryEmitBorrowedMoveOnly.
|
||||||
|
|||||||
@@ -1161,7 +1161,7 @@ static void emitCaptureArguments(SILGenFunction &SGF,
|
|||||||
fArg->setClosureCapture(true);
|
fArg->setClosureCapture(true);
|
||||||
arg = SILValue(fArg);
|
arg = SILValue(fArg);
|
||||||
|
|
||||||
// If we have an inout noncopyable paramter, insert a consumable and
|
// If we have an inout noncopyable parameter, insert a consumable and
|
||||||
// assignable.
|
// assignable.
|
||||||
//
|
//
|
||||||
// NOTE: If we have an escaping closure, we are going to emit an error later
|
// NOTE: If we have an escaping closure, we are going to emit an error later
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace swift {
|
|||||||
/// %d_0 -def-> ... -def-> %d_N -use-> %u_0 -use-> ... -use-> %u_M
|
/// %d_0 -def-> ... -def-> %d_N -use-> %u_0 -use-> ... -use-> %u_M
|
||||||
///
|
///
|
||||||
/// a sequence (possibly empty) of def projections followed by a sequence
|
/// a sequence (possibly empty) of def projections followed by a sequence
|
||||||
/// (possibly emtpy) of use projections [projection_chain_structure].
|
/// (possibly empty) of use projections [projection_chain_structure].
|
||||||
struct ValueStorage {
|
struct ValueStorage {
|
||||||
enum : uint32_t { InvalidID = uint32_t(~0) };
|
enum : uint32_t { InvalidID = uint32_t(~0) };
|
||||||
enum : uint16_t { InvalidOper = uint16_t(~0) };
|
enum : uint16_t { InvalidOper = uint16_t(~0) };
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ bool PerformanceDiagnostics::checkClosureValue(SILValue closure,
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
PrettyStackTracePerformanceDiagnostics stackTrace(
|
PrettyStackTracePerformanceDiagnostics stackTrace(
|
||||||
"validating closure (function ref, callee) - unkown callee", callInst);
|
"validating closure (function ref, callee) - unknown callee", callInst);
|
||||||
|
|
||||||
diagnose(LocWithParent(callInst->getLoc().getSourceLoc(), parentLoc), diag::performance_unknown_callees);
|
diagnose(LocWithParent(callInst->getLoc().getSourceLoc(), parentLoc), diag::performance_unknown_callees);
|
||||||
return true;
|
return true;
|
||||||
@@ -410,7 +410,7 @@ bool PerformanceDiagnostics::visitInst(SILInstruction *inst,
|
|||||||
}
|
}
|
||||||
// The default error message.
|
// The default error message.
|
||||||
PrettyStackTracePerformanceDiagnostics stackTrace(
|
PrettyStackTracePerformanceDiagnostics stackTrace(
|
||||||
"default error (fallthrough, unkown inst)", inst);
|
"default error (fallthrough, unknown inst)", inst);
|
||||||
diagnose(loc, diag::performance_metadata, "this code pattern");
|
diagnose(loc, diag::performance_metadata, "this code pattern");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ extension Slice where Base == UnsafeMutableRawBufferPointer {
|
|||||||
/// initialized memory to the elements' type.
|
/// initialized memory to the elements' type.
|
||||||
///
|
///
|
||||||
/// When calling the `initializeMemory(as:from:)` method on a buffer slice,
|
/// When calling the `initializeMemory(as:from:)` method on a buffer slice,
|
||||||
/// the memory referenced by the slice must be uninitialized or initialised
|
/// the memory referenced by the slice must be uninitialized or initialized
|
||||||
/// to a trivial type, and must be properly aligned for accessing `S.Element`.
|
/// to a trivial type, and must be properly aligned for accessing `S.Element`.
|
||||||
/// The buffer must contain sufficient memory to accommodate
|
/// The buffer must contain sufficient memory to accommodate
|
||||||
/// `source.underestimatedCount`.
|
/// `source.underestimatedCount`.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ CFunctionTakingAForwardDeclaredInterface1(incompleteInterface)
|
|||||||
|
|
||||||
let incompleteProtocol = incompleteTypeConsumer.methodReturningForwardDeclaredProtocol1()!
|
let incompleteProtocol = incompleteTypeConsumer.methodReturningForwardDeclaredProtocol1()!
|
||||||
incompleteTypeConsumer.methodTakingAForwardDeclaredProtocol1(incompleteProtocol)
|
incompleteTypeConsumer.methodTakingAForwardDeclaredProtocol1(incompleteProtocol)
|
||||||
let protcolPropertyCopy = incompleteTypeConsumer.propertyUsingAForwardDeclaredProtocol1
|
let protocolPropertyCopy = incompleteTypeConsumer.propertyUsingAForwardDeclaredProtocol1
|
||||||
incompleteTypeConsumer.propertyUsingAForwardDeclaredProtocol1 = incompleteProtocol
|
incompleteTypeConsumer.propertyUsingAForwardDeclaredProtocol1 = incompleteProtocol
|
||||||
_ = CFunctionReturningAForwardDeclaredProtocol1()
|
_ = CFunctionReturningAForwardDeclaredProtocol1()
|
||||||
CFunctionTakingAForwardDeclaredProtocol1(incompleteProtocol)
|
CFunctionTakingAForwardDeclaredProtocol1(incompleteProtocol)
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ func test_no_unused_result_warning(arr: inout [Any]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_partually_flattened_expansions() {
|
func test_partially_flattened_expansions() {
|
||||||
struct S<each T> {
|
struct S<each T> {
|
||||||
init() {}
|
init() {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %swiftc_driver_plain -target aarch64-unknwon-none-none -driver-print-jobs %s 2>&1 | %FileCheck %s
|
// RUN: %swiftc_driver_plain -target aarch64-unknown-none-none -driver-print-jobs %s 2>&1 | %FileCheck %s
|
||||||
|
|
||||||
// CHECK: {{.*}}swift{{c|-frontend}}{{(.exe)?"?}} -frontend -c
|
// CHECK: {{.*}}swift{{c|-frontend}}{{(.exe)?"?}} -frontend -c
|
||||||
// CHECK: {{.*}}clang{{(.exe)?"?}} -fuse-ld=gold
|
// CHECK: {{.*}}clang{{(.exe)?"?}} -fuse-ld=gold
|
||||||
|
|||||||
@@ -485,8 +485,8 @@ func foo() -> some P {}
|
|||||||
// CHECK: <kw>func</kw> foo() -> <kw>some</kw> <type>P</type> & <type>Q</type> {}
|
// CHECK: <kw>func</kw> foo() -> <kw>some</kw> <type>P</type> & <type>Q</type> {}
|
||||||
func foo() -> some P & Q {}
|
func foo() -> some P & Q {}
|
||||||
|
|
||||||
// CHECK: <kw>class</kw> PropertyDelgate {
|
// CHECK: <kw>class</kw> PropertyDelegate {
|
||||||
class PropertyDelgate {
|
class PropertyDelegate {
|
||||||
// CHECK: @<type>MyDelegate</type>(<int>1</int>, receiveClosure {
|
// CHECK: @<type>MyDelegate</type>(<int>1</int>, receiveClosure {
|
||||||
@MyDelegate(1, receiveClosure {
|
@MyDelegate(1, receiveClosure {
|
||||||
// CHECK: <kw>var</kw> x = <int>1</int>; x
|
// CHECK: <kw>var</kw> x = <int>1</int>; x
|
||||||
|
|||||||
@@ -1364,7 +1364,7 @@ public func ParamAttrs5(a : (@escaping () -> ()) -> ()) {
|
|||||||
// PASS_PRINT_AST: public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()
|
// PASS_PRINT_AST: public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()
|
||||||
public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()
|
public typealias ParamAttrs6 = (@autoclosure () -> ()) -> ()
|
||||||
|
|
||||||
// The following type only has the internal paramter name inferred from the
|
// The following type only has the internal parameter name inferred from the
|
||||||
// closure on the right-hand side of `=`. Thus, it is only part of the `Type`
|
// closure on the right-hand side of `=`. Thus, it is only part of the `Type`
|
||||||
// and not part of the `TypeRepr`.
|
// and not part of the `TypeRepr`.
|
||||||
// PASS_PRINT_AST_TYPE: public var ParamAttrs7: (_ f: @escaping () -> ()) -> ()
|
// PASS_PRINT_AST_TYPE: public var ParamAttrs7: (_ f: @escaping () -> ()) -> ()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ protocol P1 {
|
|||||||
// CHECK: [[@LINE+1]]:10 | protocol/Swift | P2 | s:14swift_ide_test2P2P | Def |
|
// CHECK: [[@LINE+1]]:10 | protocol/Swift | P2 | s:14swift_ide_test2P2P | Def |
|
||||||
protocol P2 {}
|
protocol P2 {}
|
||||||
|
|
||||||
// MARK: - Test extening a simple generic type
|
// MARK: - Test extending a simple generic type
|
||||||
|
|
||||||
// CHECK: [[@LINE+4]]:7 | class/Swift | Foo | s:14swift_ide_test3FooC | Def |
|
// CHECK: [[@LINE+4]]:7 | class/Swift | Foo | s:14swift_ide_test3FooC | Def |
|
||||||
// CHECK: [[@LINE+3]]:11 | type-alias/generic-type-param/Swift | OtherParam | s:14swift_ide_test3FooC10OtherParamxmfp | Def,RelChild |
|
// CHECK: [[@LINE+3]]:11 | type-alias/generic-type-param/Swift | OtherParam | s:14swift_ide_test3FooC10OtherParamxmfp | Def,RelChild |
|
||||||
@@ -63,7 +63,7 @@ extension Wrapper.Wrapped where WrapperParam: P2 {
|
|||||||
func bar(x: Bar.Assoc) {}
|
func bar(x: Bar.Assoc) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Test extening a non-generic type in a generic context
|
// MARK: - Test extending a non-generic type in a generic context
|
||||||
|
|
||||||
// CHECK: [[@LINE+1]]:16 | type-alias/generic-type-param/Swift | Wrapper2Param | s:14swift_ide_test8Wrapper2C0D5Paramxmfp | Def,RelChild |
|
// CHECK: [[@LINE+1]]:16 | type-alias/generic-type-param/Swift | Wrapper2Param | s:14swift_ide_test8Wrapper2C0D5Paramxmfp | Def,RelChild |
|
||||||
class Wrapper2<Wrapper2Param> {
|
class Wrapper2<Wrapper2Param> {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ func testOverrideOfUnavailableDeclFromUnavailableDerivedType() {
|
|||||||
|
|
||||||
func testImplicitSuperInit() {
|
func testImplicitSuperInit() {
|
||||||
// FIXME: The diagnostics for the implicit call to super.init() could be
|
// FIXME: The diagnostics for the implicit call to super.init() could be
|
||||||
// relaxed since both initialziers are unreachable and the developer cannot
|
// relaxed since both initializers are unreachable and the developer cannot
|
||||||
// wrap the call to super in a conditional compilation block.
|
// wrap the call to super in a conditional compilation block.
|
||||||
class Base {
|
class Base {
|
||||||
@available(*, unavailable)
|
@available(*, unavailable)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ struct Broken {
|
|||||||
var emptyTuple = testShadowing() // expected-warning {{variable 'emptyTuple' inferred to have type '()'}} \
|
var emptyTuple = testShadowing() // expected-warning {{variable 'emptyTuple' inferred to have type '()'}} \
|
||||||
// expected-note {{add an explicit type annotation to silence this warning}} {{15-15=: ()}}
|
// expected-note {{add an explicit type annotation to silence this warning}} {{15-15=: ()}}
|
||||||
|
|
||||||
// rdar://15263687 - Diagnose variables inferenced to 'AnyObject'
|
// rdar://15263687 - Diagnose variables inferred to 'AnyObject'
|
||||||
var ao1 : AnyObject
|
var ao1 : AnyObject
|
||||||
var ao2 = ao1
|
var ao2 = ao1
|
||||||
|
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ do {
|
|||||||
}, 0) // expected-error {{expected '{' after 'switch' subject expression}}
|
}, 0) // expected-error {{expected '{' after 'switch' subject expression}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are syntatically okay because the #if starts on a newline. This seems
|
// These are syntactically okay because the #if starts on a newline. This seems
|
||||||
// like the common case.
|
// like the common case.
|
||||||
_ = (switch Bool.random() {
|
_ = (switch Bool.random() {
|
||||||
// expected-error@-1 {{'switch' may only be used as expression in return, throw, or as the source of an assignment}}
|
// expected-error@-1 {{'switch' may only be used as expression in return, throw, or as the source of an assignment}}
|
||||||
|
|||||||
Reference in New Issue
Block a user