-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed as not planned
Closed as not planned
Copy link
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexistential member accessesFeature → existentials: existential member accessesFeature → existentials: existential member accessesexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesnot a bugResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer errorResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer erroropaque result typesFeature → types → opaque types: opaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesFeature → types: opaque typesprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationsswift 5.7
Description
Describe the bug
keyword "some" will be inferred as "any" in Protocol extension function
Steps To Reproduce
Steps to reproduce the behavior:
- using keyword "some" in a Protocol extension function
- using this function in Generic function
import SwiftUI
protocol Ability { }
extension Ability {
func image() -> some View {
Image("").resizable()
}
}
struct MainAbility: Ability { }
let ability: Ability = MainAbility()
HStack {
ability.image()
}
Expected behavior
Compiler can build successfully.
Environment (please fill out the following information)
- OS: [e.g. macOS 12.6]
- Xcode 14.1 beta 3 (14B5033e)
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexistential member accessesFeature → existentials: existential member accessesFeature → existentials: existential member accessesexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesnot a bugResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer errorResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer erroropaque result typesFeature → types → opaque types: opaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesFeature → types: opaque typesprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationsswift 5.7