Skip to content

Commit f201999

Browse files
committed
[ASTDumper] Don't call isFinal()
Avoid triggering the semantic `IsFinalRequest` and instead check for the presence of the final attribute. Resolves SR-13230.
1 parent 008ce5b commit f201999

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,14 @@ namespace {
772772
}
773773

774774
auto VarD = dyn_cast<VarDecl>(VD);
775-
if (VD->isFinal() && !(VarD && VarD->isLet()))
775+
const auto &attrs = VD->getAttrs();
776+
if (attrs.hasAttribute<FinalAttr>() && !(VarD && VarD->isLet()))
776777
OS << " final";
777-
if (VD->getAttrs().hasAttribute<ObjCAttr>())
778+
if (attrs.hasAttribute<ObjCAttr>())
778779
OS << " @objc";
779-
if (VD->getAttrs().hasAttribute<DynamicAttr>())
780+
if (attrs.hasAttribute<DynamicAttr>())
780781
OS << " dynamic";
781-
if (auto *attr =
782-
VD->getAttrs().getAttribute<DynamicReplacementAttr>()) {
782+
if (auto *attr = attrs.getAttribute<DynamicReplacementAttr>()) {
783783
OS << " @_dynamicReplacement(for: \"";
784784
OS << attr->getReplacedFunctionName();
785785
OS << "\")";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %target-swift-frontend -dump-parse %s
2+
3+
// Make sure we don't do any Sema and don't crash.
4+
extension X {
5+
typealias Y = Z
6+
}

0 commit comments

Comments
 (0)