Skip to content

Commit 1244b17

Browse files
committed
AST: Fix WhereClauseOwner::getLoc() and simple_display() for DifferentiableAttr
We forgot to handle this case, which would lead to a crash.
1 parent dc7688e commit 1244b17

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/AST/TypeCheckRequests.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ SourceLoc WhereClauseOwner::getLoc() const {
356356
if (auto attr = source.dyn_cast<SpecializeAttr *>())
357357
return attr->getLocation();
358358

359+
if (auto attr = source.dyn_cast<DifferentiableAttr *>())
360+
return attr->getLocation();
361+
359362
return source.get<GenericParamList *>()->getWhereLoc();
360363
}
361364

@@ -365,6 +368,8 @@ void swift::simple_display(llvm::raw_ostream &out,
365368
simple_display(out, owner.dc->getAsDecl());
366369
} else if (owner.source.is<SpecializeAttr *>()) {
367370
out << "@_specialize";
371+
} else if (owner.source.is<DifferentiableAttr *>()) {
372+
out << "@_differentiable";
368373
} else {
369374
out << "(SIL generic parameter list)";
370375
}

0 commit comments

Comments
 (0)