Variable changes value while running test

(Also posted here: swift - Variable magically changes value - Stack Overflow)

I have this extremely weird scenario. Suddenly my test is failing and I can not create a reproduction path because it succeeds on simple projects. I also can not reproduce it consistently so I will show what is wrong:

You can see that the values that I used are different than the parameter values. This fails my test. I have never seen anything like this before. I am using Xcode 13.1. Is there anything I can try?

I am seeing more weird behavior. I pass in nil as an parameter argument to a func. In that func, if the parameter is nil, it should return. But Swift happely decides to just fill it with a value:

I can't post more than 1 image, so to continue my story about Swift filling a random value for a passed in nil value:

Not sure why the argument.inBetween is nil and the local variable inBetween value is filled

An the func receives a value:

To make it more strange: newRequest was given a value I literally never init in my codebase (didntProcessNonPersistentRequest is an enum case).

Terms of Service

Privacy Policy

Cookie Policy