Flow: Xcode 10 crashes with ReadWriteSignal
Expected Behavior
The ReadWriteSignal
setter should not crash
Current Behavior
ReadWriteSignal
crashes when trying to access its setter
Steps to Reproduce
Here is a simple unit test to reproduce the crash
func testReadWriteSignalCrashing() {
ReadWriteSignal(CGPoint.zero).value.x = 2 // This one crashes for some reason
}
Note that these tests are passing:
func testReadWriteSignalNotCrashing() {
ReadWriteSignal(CGPoint.zero).value = CGPoint(x: 2, y: 0) // This is fine
let signal = ReadWriteSignal(CGPoint.zero)
signal.value.x = 2 // This is also fine
}
Context
The test fails when building with Xcode 10
Failure Logs
Error:
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 18 (12 by maintainers)
I played a bit with this bug, and this is the minimum of code I could find that reproduces the issue:
I suspect that it has something to do with the
nonmutating
key-word. I guess the compiler is a bit too agressive since I guess it assumes that the object is safe to be deallocated because it won’t be mutated.