Skip to content

Commit 05c951f

Browse files
committed
Compute layout when emitting an other-constructor reference.
Fixes SE-9233, a crash due to a failure to validate a storage declaration within a protocol when generating a call to an initiializer.
1 parent c6874bb commit 05c951f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,8 @@ namespace {
16301630

16311631
auto ref = ConcreteDeclRef(ctor, substitutions);
16321632

1633+
tc.requestMemberLayout(ctor);
1634+
16331635
// The constructor was opened with the allocating type, not the
16341636
// initializer type. Map the former into the latter.
16351637
auto resultTy = solution.simplifyType(openedFullType);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
protocol P {
2+
init()
3+
var x: Int { get set }
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend -emit-ir -module-name test %S/Inputs/protocol-extension-init-helper.swift -primary-file %s
2+
3+
// SE-9233: compute layout when emitting an other-constructor reference
4+
extension P {
5+
public init(possibly: Bool) {
6+
self.init()
7+
}
8+
}

0 commit comments

Comments
 (0)