mirror of
https://github.com/apple/swift.git
synced 2026-11-01 23:11:50 +01:00
Rethrows checking only recognized a parameter that's referenced directly, but a reference to a `consuming` parameter goes through a load expression since the parameter is mutable. `@once` and `@callable(once)` parameters are implicitly `consuming` and as a result a `rethrows` function couldn't call or forward such a parameter without being diagnosed as throwing an error that didn't come from the parameter. Look through loads of a function-typed parameter during effects checking. Also look through explicit `consume` and `copy` expressions since they also return their value directly. Only treat a call of a `consuming` parameter as rethrowing if the body only ever reads it, since any other use might replace the closure with a different one and violate rethrows semantics. Resolves rdar://190772877.