Skip to content

Commit 4a3938b

Browse files
committed
Fix: avoid getInnermostDeclContext()
1 parent 78fc5cd commit 4a3938b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,10 @@ static CanSILFunctionType getSILFunctionTypeForInitAccessor(
28682868
AbstractionPattern origType, CanAnyFunctionType substAccessorType,
28692869
SILExtInfoBuilder extInfoBuilder, const Conventions &conventions,
28702870
SILDeclRef constant) {
2871-
auto *declContext = constant.getInnermostDeclContext();
2871+
auto *decl = constant.getDecl();
2872+
DeclContext *declContext = isa<AccessorDecl>(decl)
2873+
? cast<AccessorDecl>(decl)->getDeclContext()
2874+
: cast<VarDecl>(decl)->getDeclContext();
28722875
CanGenericSignature genericSig = substAccessorType.getOptGenericSignature();
28732876

28742877
std::optional<TypeConverter::GenericContextRAII> contextRAII;

0 commit comments

Comments
 (0)