Skip to content

Commit 8356ab4

Browse files
committed
[ConstraintSystem] NFC: Avoid use of designated initializers to make Windows happy
1 parent f2985d5 commit 8356ab4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4729,6 +4729,10 @@ class ConstraintSystem {
47294729
/// this points to the source of the binding.
47304730
mutable Constraint *CoveredBy = nullptr;
47314731

4732+
LiteralRequirement(Constraint *source, Type defaultTy, bool isDirect)
4733+
: Source(source), DefaultType(defaultTy),
4734+
IsDirectRequirement(isDirect) {}
4735+
47324736
Constraint *getSource() const { return Source; }
47334737

47344738
ProtocolDecl *getProtocol() const { return Source->getProtocol(); }

lib/Sema/CSBindings.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -664,19 +664,16 @@ void ConstraintSystem::PotentialBindings::addLiteral(Constraint *constraint) {
664664
// doesn't have a default type.
665665
if (protocol->isSpecificProtocol(
666666
KnownProtocolKind::ExpressibleByNilLiteral)) {
667-
Literals.insert({protocol,
668-
{.Source = constraint,
669-
.DefaultType = Type(),
670-
.IsDirectRequirement = isDirect}});
667+
Literals.insert(
668+
{protocol, LiteralRequirement(constraint,
669+
/*DefaultType=*/Type(), isDirect)});
671670
return;
672671
}
673672

674673
// Check whether any of the existing bindings covers this literal
675674
// protocol.
676-
LiteralRequirement literal{.Source = constraint,
677-
.DefaultType =
678-
TypeChecker::getDefaultType(protocol, CS.DC),
679-
.IsDirectRequirement = isDirect};
675+
LiteralRequirement literal(
676+
constraint, TypeChecker::getDefaultType(protocol, CS.DC), isDirect);
680677

681678
{
682679
bool allowsNil = canBeNil();

0 commit comments

Comments
 (0)