Skip to content

Commit c5b74af

Browse files
authored
Merge pull request #7441 from slavapestov/fix-silgen-extension-initializer
SILGen: Fix corner-case in emission of extension initializer
2 parents cd6474c + 2fac864 commit c5b74af

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/SIL/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ static CanAnyFunctionType getStoredPropertyInitializerInterfaceType(
17781778
ASTContext &context) {
17791779
auto *DC = VD->getDeclContext();
17801780
CanType resultTy =
1781-
DC->mapTypeOutOfContext(VD->getParentInitializer()->getType())
1781+
DC->mapTypeOutOfContext(VD->getParentPattern()->getType())
17821782
->getCanonicalType();
17831783
GenericSignature *sig = DC->getGenericSignatureOfContext();
17841784

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
struct HasInitValue {
22
var x = 10
3+
var y: String = ""
34
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -emit-silgen -primary-file %s %S/Inputs/struct_with_initializer.swift -module-name extensions_multifile | %FileCheck %s
22

3-
// CHECK-LABEL: sil hidden @_T020extensions_multifile12HasInitValueVACSi1x_tcfC : $@convention(method) (Int, @thin HasInitValue.Type) -> HasInitValue {
3+
// CHECK-LABEL: sil hidden @_T020extensions_multifile12HasInitValueVACSi1z_tcfC : $@convention(method) (Int, @thin HasInitValue.Type) -> @owned HasInitValue {
44
// CHECK: function_ref @_T020extensions_multifile12HasInitValueV1xSivfi : $@convention(thin) () -> Int
55

66
// CHECK-LABEL: sil hidden_external [transparent] @_T020extensions_multifile12HasInitValueV1xSivfi : $@convention(thin) () -> Int
77

88
extension HasInitValue {
9-
init(x: Int) {}
9+
init(z: Int) {}
1010
}

0 commit comments

Comments
 (0)