Skip to content

keyword "some" will be inferred as "any" in Protocol extension function #61591

@miku1958

Description

@miku1958

Describe the bug
keyword "some" will be inferred as "any" in Protocol extension function

Steps To Reproduce
Steps to reproduce the behavior:

  1. using keyword "some" in a Protocol extension function
  2. 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.

Screenshots
image

Environment (please fill out the following information)

  • OS: [e.g. macOS 12.6]
  • Xcode 14.1 beta 3 (14B5033e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfexistential member accessesFeature → existentials: existential member accessesexistentialsFeature: 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 erroropaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesprotocolFeature → type declarations: Protocol declarationsswift 5.7

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions