with the unconditional change, Sema/diag_erroneous_iuo.swift failed on this:
func opaqueResult() -> (some Equatable)! { return 1 }
// expected-swift4-warning@-1:40 {{using '!' here is deprecated; this is an error in the Swift 5 language mode}}{{none}}
// expected-swift5-error@-2:40 {{'!' is not allowed here}}{{none}}
// expected-note@-3:40 {{use '?' instead}}{{40-41=?}}
as the warnings are no longer produced. i can't say i have a good sense of what that is trying to enforce, and why these variations do not seem to produce similar diagnostics:
func exIUO() -> (any Equatable)! { 1 }
func genIUO<T: Equatable>() -> T! { T?.none }
with the caveat that i'm not certain about the best way to infer this information, printing things out in various places made it seem like non-opaque returns from computed properties forward to their value's interface type (so presumably use whatever context value is appropriate there; not sure what that is exactly), and subscripts resolve the type repr of their element type and then evaluate that with the FunctionResult context.
i think we may still need some special casing somewhere because the unconditional change makes this valid:
protocol P {}
struct S: P {}
var computedSendingOpaque: sending (some P) { S() } // ✅
but this still is not:
var computedSendingConcrete: sending S { S() } // 🛑
also, the unconditional change appears to affect other types of declarations, like stored properties or local variables and admits sending in invalid positions, like:
let sendOpaque: sending (some Equatable) = 0 // ✅⁉️
though sending does feel like it should be valid on computed properties, that seems like a related, but separate issue to its simply not working at all in legal positions with opaque result types.
setting the context back to None in the case that the originating decl for the opaque result type request is a VarDecl seems to restore the existing diagnostic behavior in these cases, but idk how principled of a solution that is really. perhaps a safer approach would be to change the resolver context to 'function result' when the originating decl is a subscript or abstract function type, and then other cases will perhaps retain their existing (hopefully correct) behavior for now.
edit: actually just restricting to functions/subscripts isn't going to resolve that existing unit test failure with the IUO return value i don't think... so something will have to be done with that.