Skip to content

Commit a559ca8

Browse files
committed
[TypeChecker/SE-0307] NFC: Fix typos and clarify a couple of comments
Thanks Xiaodi Wu!
1 parent 0e6198d commit a559ca8

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

include/swift/AST/Types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,8 @@ class alignas(1 << TypeAlignInBits) TypeBase {
800800
/// Check if this is a nominal type defined at the top level of the Swift module
801801
bool isStdlibType();
802802

803-
/// Check if this is a CGFloat type from `CoreGraphics` module.
803+
/// Check if this is a CGFloat type from CoreGraphics framework
804+
/// on macOS or Foundation on Linux.
804805
bool isCGFloatType();
805806

806807
/// Check if this is a Double type from standard library.

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ namespace swift {
580580
/// See \ref FrontendOptions.PrintFullConvention
581581
bool PrintFullConvention = false;
582582

583-
/// Disallow Double and CGFloat types to be used interchangeably.
583+
/// Disallow Double and CGFloat types from being used interchangeably.
584584
bool DisableImplicitDoubleCGFloatConversion = false;
585585
};
586586

include/swift/Sema/Constraint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ enum class ConversionRestrictionKind {
262262
/// an implicit CGFloat initializer call.
263263
DoubleToCGFloat,
264264
/// Implicit conversion from a value of CGFloat type to a value of Double type
265-
/// via an implicit call to an initializer passing CGFloat value.
265+
/// via an implicit Double initializer call passing a CGFloat value.
266266
CGFloatToDouble,
267267
};
268268

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ enum ScoreKind {
794794
SK_ForceUnchecked,
795795
/// An implicit conversion from a value of one type (lhs)
796796
/// to another type (rhs) via implicit initialization of
797-
/// `rhs` type which an argument of `lhs` value.
797+
/// `rhs` type with an argument of `lhs` value.
798798
SK_ImplicitValueConversion,
799799
/// A user-defined conversion.
800800
SK_UserConversion,
@@ -1406,7 +1406,7 @@ enum class ConstraintSystemFlags {
14061406
/// `__attribute__((ns_consumed))`.
14071407
UseClangFunctionTypes = 0x80,
14081408

1409-
/// Disallow to use Double and CGFloat interchangeably through means of
1409+
/// Disallow using Double and CGFloat interchangeably by means of
14101410
/// an implicit value conversion.
14111411
DisableImplicitDoubleCGFloatConversion = 0x100,
14121412
};

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ bool TypeBase::isCGFloatType() {
822822
return false;
823823

824824
auto *module = DC->getParentModule();
825-
// on macOS `CGFloat` is part of a `CoreGraphics` module,
825+
// On macOS `CGFloat` is part of a `CoreGraphics` module,
826826
// but on Linux it could be found in `Foundation`.
827827
return (module->getName().is("CoreGraphics") ||
828828
module->getName().is("Foundation")) &&

lib/Sema/CSGen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ namespace {
565565
->getWithoutParens()
566566
->getWithoutSpecifierType();
567567

568-
// There is no CGFloat overloads on some of the unary operators, so
569-
// in order to preserve current behavior let's not favor overloads
570-
// which would result in conversion from CGFloat to Double otherwise
568+
// There are no CGFloat overloads on some of the unary operators, so
569+
// in order to preserve current behavior, let's not favor overloads
570+
// which would result in conversion from CGFloat to Double; otherwise
571571
// it would lead to ambiguities.
572572
if (argTy->isCGFloatType() && paramTy->isDoubleType())
573573
return false;

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5120,7 +5120,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
51205120

51215121
auto isCoercionOrCast = [](ASTNode anchor,
51225122
ArrayRef<LocatorPathElt> path) {
5123-
// e.g. contextual conversion from coercion/cast
5123+
// E.g. contextual conversion from coercion/cast
51245124
// to some other type.
51255125
if (!path.empty())
51265126
return false;
@@ -10576,12 +10576,12 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
1057610576
auto *memberLoc = getConstraintLocator(
1057710577
applicationLoc, ConstraintLocator::ConstructorMember);
1057810578

10579-
// This conversion has been already attempted for and constructor
10580-
// choice has been recorded.
10579+
// Conversion has been already attempted for this direction
10580+
// and constructor choice has been recorded.
1058110581
if (findSelectedOverloadFor(memberLoc))
1058210582
return SolutionKind::Solved;
1058310583

10584-
// Allocate a single argument info to conver all possible
10584+
// Allocate a single argument info to cover all possible
1058510585
// Double <-> CGFloat conversion locations.
1058610586
if (!ArgumentInfos.count(memberLoc)) {
1058710587
auto &ctx = getASTContext();

lib/Sema/CSStep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ bool DisjunctionStep::shouldSkip(const DisjunctionChoice &choice) const {
702702
// Not all of the unary operators have `CGFloat` overloads,
703703
// so in order to preserve previous behavior (and overall
704704
// best solution) with implicit Double<->CGFloat conversion
705-
// we need to allow attempting generic operators for such cases.
705+
// we need to allow attempting generic operators for such cases.
706706
if (score[SK_ImplicitValueConversion] > 0 && choice.isUnaryOperator())
707707
return false;
708708

0 commit comments

Comments
 (0)