@@ -209,10 +209,9 @@ enum class ConstraintKind : char {
209209 // / inferred from a conversion, so the check is more relax comparing to
210210 // / `ConformsTo`.
211211 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,
216215 // / Do not add new uses of this, it only exists to retain compatibility for
217216 // / rdar://85263844.
218217 // /
@@ -240,8 +239,8 @@ enum class ConstraintClassification : char {
240239 // / A conjunction constraint.
241240 Conjunction,
242241
243- // / An element of a closure body.
244- ClosureElement ,
242+ // / An element of a closure/function body.
243+ SyntacticElement ,
245244};
246245
247246// / Specifies a restriction on the kind of conversion that should be
@@ -448,7 +447,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
448447 ContextualTypeInfo Context;
449448 // / Identifies whether result of this node is unused.
450449 bool IsDiscarded;
451- } ClosureElement ;
450+ } SyntacticElement ;
452451 };
453452
454453 // / The locator that describes where in the expression this
@@ -589,12 +588,12 @@ class Constraint final : public llvm::ilist_node<Constraint>,
589588 Optional<TrailingClosureMatching> trailingClosureMatching,
590589 ConstraintLocator *locator);
591590
592- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
591+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
593592 ASTNode node,
594593 ConstraintLocator *locator,
595594 bool isDiscarded = false );
596595
597- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
596+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
598597 ASTNode node,
599598 ContextualTypeInfo context,
600599 ConstraintLocator *locator,
@@ -708,8 +707,8 @@ class Constraint final : public llvm::ilist_node<Constraint>,
708707 case ConstraintKind::Conjunction:
709708 return ConstraintClassification::Conjunction;
710709
711- case ConstraintKind::ClosureBodyElement :
712- return ConstraintClassification::ClosureElement ;
710+ case ConstraintKind::SyntacticElement :
711+ return ConstraintClassification::SyntacticElement ;
713712 }
714713
715714 llvm_unreachable (" Unhandled ConstraintKind in switch." );
@@ -732,7 +731,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
732731 case ConstraintKind::ValueWitness:
733732 return Member.First ;
734733
735- case ConstraintKind::ClosureBodyElement :
734+ case ConstraintKind::SyntacticElement :
736735 llvm_unreachable (" closure body element constraint has no type operands" );
737736
738737 default :
@@ -746,7 +745,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
746745 case ConstraintKind::Disjunction:
747746 case ConstraintKind::Conjunction:
748747 case ConstraintKind::BindOverload:
749- case ConstraintKind::ClosureBodyElement :
748+ case ConstraintKind::SyntacticElement :
750749 llvm_unreachable (" constraint has no second type" );
751750
752751 case ConstraintKind::ValueMember:
@@ -855,19 +854,19 @@ class Constraint final : public llvm::ilist_node<Constraint>,
855854 return Member.UseDC ;
856855 }
857856
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 ;
861860 }
862861
863862 ContextualTypeInfo getElementContext () const {
864- assert (Kind == ConstraintKind::ClosureBodyElement );
865- return ClosureElement .Context ;
863+ assert (Kind == ConstraintKind::SyntacticElement );
864+ return SyntacticElement .Context ;
866865 }
867866
868867 bool isDiscardedElement () const {
869- assert (Kind == ConstraintKind::ClosureBodyElement );
870- return ClosureElement .IsDiscarded ;
868+ assert (Kind == ConstraintKind::SyntacticElement );
869+ return SyntacticElement .IsDiscarded ;
871870 }
872871
873872 // / For an applicable function constraint, retrieve the trailing closure
0 commit comments