File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1412,7 +1412,8 @@ namespace {
14121412 SGF.getModule ().getSwiftModule (), ctor);
14131413
14141414 Type ity = ctor->getInterfaceType ();
1415- AnyFunctionType *substIty = ity.subst (subs)->castTo <AnyFunctionType>();
1415+ AnyFunctionType *substIty =
1416+ ity.subst (subs)->getCanonicalType ()->castTo <AnyFunctionType>();
14161417
14171418 auto initRef = SILDeclRef (ctor, SILDeclRef::Kind::Allocator)
14181419 .asForeign (requiresForeignEntryPoint (ctor));
Original file line number Diff line number Diff line change @@ -346,8 +346,26 @@ func testDefaultInit() {
346346 // CHECK: set value hello
347347}
348348
349+ // rdar://problem/51581937: DI crash with a property wrapper of an optional
350+ struct OptIntStruct {
351+ @Wrapper var wrapped : Int ?
352+
353+ init ( ) {
354+ wrapped = 42
355+ }
356+ }
357+
358+ func testOptIntStruct( ) {
359+ // CHECK: ## OptIntStruct
360+ print ( " \n ## OptIntStruct " )
361+
362+ let use = OptIntStruct ( )
363+ // CHECK-NEXT: .. init Optional(42)
364+ }
365+
349366testIntStruct ( )
350367testIntClass ( )
351368testRefStruct ( )
352369testGenericClass ( )
353370testDefaultInit ( )
371+ testOptIntStruct ( )
You can’t perform that action at this time.
0 commit comments