@@ -209,10 +209,9 @@ enum class ConstraintKind : char {
209
209
// / inferred from a conversion, so the check is more relax comparing to
210
210
// / `ConformsTo`.
211
211
TransitivelyConformsTo,
212
- // / Represents an AST node contained in a body of a closure. It has only
213
- // / one type - type variable representing type of a node, other side is
214
- // / the AST node to infer the type for.
215
- ClosureBodyElement,
212
+ // / Represents an AST node contained in a body of a function/closure.
213
+ // / It only has an AST node to generate constraints and infer the type for.
214
+ SyntacticElement,
216
215
// / Do not add new uses of this, it only exists to retain compatibility for
217
216
// / rdar://85263844.
218
217
// /
@@ -240,8 +239,8 @@ enum class ConstraintClassification : char {
240
239
// / A conjunction constraint.
241
240
Conjunction,
242
241
243
- // / An element of a closure body.
244
- ClosureElement ,
242
+ // / An element of a closure/function body.
243
+ SyntacticElement ,
245
244
};
246
245
247
246
// / Specifies a restriction on the kind of conversion that should be
@@ -448,7 +447,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
448
447
ContextualTypeInfo Context;
449
448
// / Identifies whether result of this node is unused.
450
449
bool IsDiscarded;
451
- } ClosureElement ;
450
+ } SyntacticElement ;
452
451
};
453
452
454
453
// / The locator that describes where in the expression this
@@ -589,12 +588,12 @@ class Constraint final : public llvm::ilist_node<Constraint>,
589
588
Optional<TrailingClosureMatching> trailingClosureMatching,
590
589
ConstraintLocator *locator);
591
590
592
- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
591
+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
593
592
ASTNode node,
594
593
ConstraintLocator *locator,
595
594
bool isDiscarded = false );
596
595
597
- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
596
+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
598
597
ASTNode node,
599
598
ContextualTypeInfo context,
600
599
ConstraintLocator *locator,
@@ -708,8 +707,8 @@ class Constraint final : public llvm::ilist_node<Constraint>,
708
707
case ConstraintKind::Conjunction:
709
708
return ConstraintClassification::Conjunction;
710
709
711
- case ConstraintKind::ClosureBodyElement :
712
- return ConstraintClassification::ClosureElement ;
710
+ case ConstraintKind::SyntacticElement :
711
+ return ConstraintClassification::SyntacticElement ;
713
712
}
714
713
715
714
llvm_unreachable (" Unhandled ConstraintKind in switch." );
@@ -732,7 +731,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
732
731
case ConstraintKind::ValueWitness:
733
732
return Member.First ;
734
733
735
- case ConstraintKind::ClosureBodyElement :
734
+ case ConstraintKind::SyntacticElement :
736
735
llvm_unreachable (" closure body element constraint has no type operands" );
737
736
738
737
default :
@@ -746,7 +745,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
746
745
case ConstraintKind::Disjunction:
747
746
case ConstraintKind::Conjunction:
748
747
case ConstraintKind::BindOverload:
749
- case ConstraintKind::ClosureBodyElement :
748
+ case ConstraintKind::SyntacticElement :
750
749
llvm_unreachable (" constraint has no second type" );
751
750
752
751
case ConstraintKind::ValueMember:
@@ -855,19 +854,19 @@ class Constraint final : public llvm::ilist_node<Constraint>,
855
854
return Member.UseDC ;
856
855
}
857
856
858
- ASTNode getClosureElement () const {
859
- assert (Kind == ConstraintKind::ClosureBodyElement );
860
- return ClosureElement .Element ;
857
+ ASTNode getSyntacticElement () const {
858
+ assert (Kind == ConstraintKind::SyntacticElement );
859
+ return SyntacticElement .Element ;
861
860
}
862
861
863
862
ContextualTypeInfo getElementContext () const {
864
- assert (Kind == ConstraintKind::ClosureBodyElement );
865
- return ClosureElement .Context ;
863
+ assert (Kind == ConstraintKind::SyntacticElement );
864
+ return SyntacticElement .Context ;
866
865
}
867
866
868
867
bool isDiscardedElement () const {
869
- assert (Kind == ConstraintKind::ClosureBodyElement );
870
- return ClosureElement .IsDiscarded ;
868
+ assert (Kind == ConstraintKind::SyntacticElement );
869
+ return SyntacticElement .IsDiscarded ;
871
870
}
872
871
873
872
// / For an applicable function constraint, retrieve the trailing closure
0 commit comments