@@ -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
@@ -450,7 +449,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
450
449
ContextualTypeInfo Context;
451
450
// / Identifies whether result of this node is unused.
452
451
bool IsDiscarded;
453
- } ClosureElement ;
452
+ } SyntacticElement ;
454
453
};
455
454
456
455
// / The locator that describes where in the expression this
@@ -591,12 +590,12 @@ class Constraint final : public llvm::ilist_node<Constraint>,
591
590
Optional<TrailingClosureMatching> trailingClosureMatching,
592
591
ConstraintLocator *locator);
593
592
594
- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
593
+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
595
594
ASTNode node,
596
595
ConstraintLocator *locator,
597
596
bool isDiscarded = false );
598
597
599
- static Constraint *createClosureBodyElement (ConstraintSystem &cs,
598
+ static Constraint *createSyntacticElement (ConstraintSystem &cs,
600
599
ASTNode node,
601
600
ContextualTypeInfo context,
602
601
ConstraintLocator *locator,
@@ -710,8 +709,8 @@ class Constraint final : public llvm::ilist_node<Constraint>,
710
709
case ConstraintKind::Conjunction:
711
710
return ConstraintClassification::Conjunction;
712
711
713
- case ConstraintKind::ClosureBodyElement :
714
- return ConstraintClassification::ClosureElement ;
712
+ case ConstraintKind::SyntacticElement :
713
+ return ConstraintClassification::SyntacticElement ;
715
714
}
716
715
717
716
llvm_unreachable (" Unhandled ConstraintKind in switch." );
@@ -734,7 +733,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
734
733
case ConstraintKind::ValueWitness:
735
734
return Member.First ;
736
735
737
- case ConstraintKind::ClosureBodyElement :
736
+ case ConstraintKind::SyntacticElement :
738
737
llvm_unreachable (" closure body element constraint has no type operands" );
739
738
740
739
default :
@@ -748,7 +747,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
748
747
case ConstraintKind::Disjunction:
749
748
case ConstraintKind::Conjunction:
750
749
case ConstraintKind::BindOverload:
751
- case ConstraintKind::ClosureBodyElement :
750
+ case ConstraintKind::SyntacticElement :
752
751
llvm_unreachable (" constraint has no second type" );
753
752
754
753
case ConstraintKind::ValueMember:
@@ -857,19 +856,19 @@ class Constraint final : public llvm::ilist_node<Constraint>,
857
856
return Member.UseDC ;
858
857
}
859
858
860
- ASTNode getClosureElement () const {
861
- assert (Kind == ConstraintKind::ClosureBodyElement );
862
- return ClosureElement .Element ;
859
+ ASTNode getSyntacticElement () const {
860
+ assert (Kind == ConstraintKind::SyntacticElement );
861
+ return SyntacticElement .Element ;
863
862
}
864
863
865
864
ContextualTypeInfo getElementContext () const {
866
- assert (Kind == ConstraintKind::ClosureBodyElement );
867
- return ClosureElement .Context ;
865
+ assert (Kind == ConstraintKind::SyntacticElement );
866
+ return SyntacticElement .Context ;
868
867
}
869
868
870
869
bool isDiscardedElement () const {
871
- assert (Kind == ConstraintKind::ClosureBodyElement );
872
- return ClosureElement .IsDiscarded ;
870
+ assert (Kind == ConstraintKind::SyntacticElement );
871
+ return SyntacticElement .IsDiscarded ;
873
872
}
874
873
875
874
// / For an applicable function constraint, retrieve the trailing closure
0 commit comments