File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -675,10 +675,10 @@ void SILGenModule::visitFuncDecl(FuncDecl *fd) { emitFunction(fd); }
675
675
// / Emit a function now, if it's externally usable or has been referenced in
676
676
// / the current TU, or remember how to emit it later if not.
677
677
template <typename /* void (SILFunction*)*/ Fn>
678
- void emitOrDelayFunction (SILGenModule &SGM,
679
- SILDeclRef constant,
680
- Fn &&emitter,
681
- bool forceEmission = false ) {
678
+ static void emitOrDelayFunction (SILGenModule &SGM,
679
+ SILDeclRef constant,
680
+ Fn &&emitter,
681
+ bool forceEmission = false ) {
682
682
auto emitAfter = SGM.lastEmittedFunction ;
683
683
684
684
SILFunction *f = nullptr ;
@@ -1312,7 +1312,8 @@ void SILGenModule::visitVarDecl(VarDecl *vd) {
1312
1312
case AccessorKind::Read:
1313
1313
return impl.getReadImpl () != ReadImplKind::Read;
1314
1314
case AccessorKind::Set:
1315
- return impl.getWriteImpl () != WriteImplKind::Set;
1315
+ return impl.getWriteImpl () != WriteImplKind::Set &&
1316
+ impl.getWriteImpl () != WriteImplKind::StoredWithObservers;
1316
1317
case AccessorKind::Modify:
1317
1318
return impl.getReadWriteImpl () != ReadWriteImplKind::Modify;
1318
1319
#define ACCESSOR (ID ) \
Original file line number Diff line number Diff line change @@ -22,3 +22,16 @@ func useProps() -> (Int, Int) {
22
22
return ( globalProp, Fooo . staticProp)
23
23
}
24
24
25
+ // rdar://46472759
26
+ // We used to crash tying to double-emit the setter.
27
+ struct Bar {
28
+ mutating func mutate( ) { }
29
+ }
30
+ func useGlobalBar( ) -> Bar {
31
+ globalBar = Bar ( )
32
+ globalBar. mutate ( )
33
+ return globalBar
34
+ }
35
+ private var globalBar = Bar ( ) {
36
+ willSet { }
37
+ }
You can’t perform that action at this time.
0 commit comments