swiftlang/swift

Incorrect fix-it for static member access on instance

Open

#85.157 aberto em 27 de out. de 2025

Ver no GitHub
 (2 comments) (0 reactions) (1 assignee)Swift (10.719 forks)batch import
compilerdiagnostics qualityfix-itsgenericsgood first issueopaque parameter typesstatic declarationstype checker

Métricas do repositório

Stars
 (69.989 stars)
Métricas de merge de PR
 (Mesclagem média 7d 6h) (556 fundiu PRs em 30d)

Description

Description

In the following example the compiler offers to replace p with some P, which is obviously not going to work. The same applies to any P.

Reproduction

protocol P {
  static var x: Int {get}
}
func foo(p: some P) -> Int {
  p.x
}

Expected behavior

We should probably make it wrap the base in type(of:) instead.

Environment

Swift version 6.3-dev (1ae8ef0004e7405)

Additional information

No response

Guia do colaborador