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 @@ -1409,7 +1409,8 @@ namespace {
1409
1409
SGF.getModule ().getSwiftModule (), ctor);
1410
1410
1411
1411
Type ity = ctor->getInterfaceType ();
1412
- AnyFunctionType *substIty = ity.subst (subs)->castTo <AnyFunctionType>();
1412
+ AnyFunctionType *substIty =
1413
+ ity.subst (subs)->getCanonicalType ()->castTo <AnyFunctionType>();
1413
1414
1414
1415
auto initRef = SILDeclRef (ctor, SILDeclRef::Kind::Allocator)
1415
1416
.asForeign (requiresForeignEntryPoint (ctor));
Original file line number Diff line number Diff line change @@ -346,8 +346,26 @@ func testDefaultInit() {
346
346
// CHECK: set value hello
347
347
}
348
348
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
+
349
366
testIntStruct ( )
350
367
testIntClass ( )
351
368
testRefStruct ( )
352
369
testGenericClass ( )
353
370
testDefaultInit ( )
371
+ testOptIntStruct ( )
You can’t perform that action at this time.
0 commit comments