File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,11 @@ bool ConstraintLocator::isForCoercion() const {
243
243
return anchor && isa<CoerceExpr>(anchor) && getPath ().empty ();
244
244
}
245
245
246
+ bool ConstraintLocator::isForOptionalTry () const {
247
+ auto *anchor = getAnchor ();
248
+ return anchor && isa<OptionalTryExpr>(anchor) && getPath ().empty ();
249
+ }
250
+
246
251
GenericTypeParamType *ConstraintLocator::getGenericParameter () const {
247
252
// Check whether we have a path that terminates at a generic parameter.
248
253
return isForGenericParameter () ?
Original file line number Diff line number Diff line change @@ -371,6 +371,9 @@ class ConstraintLocator : public llvm::FoldingSetNode {
371
371
// / Determine whether this locator points to the coercion expression.
372
372
bool isForCoercion () const ;
373
373
374
+ // / Determine whether this locator points to the `try?` expression.
375
+ bool isForOptionalTry () const ;
376
+
374
377
// / Attempts to cast the first path element of the locator to a specific
375
378
// / \c LocatorPathElt subclass, returning \c None if either unsuccessful or
376
379
// / the locator has no path elements.
You can’t perform that action at this time.
0 commit comments