Avatar
@swift-5.8.1 @swift-5.7.3 @swift-main protocol P { func p() } struct Box<T> { var value: T } func f() -> Box<some P> { struct S: P { func p() { print("S in f()") } } return Box(value: S()) } let result = f() result.value.p() (edited)