Skip to content

incorrect compiler warning when shadowing integer generic parameter via static property #84026

@lukaskollmer

Description

@lukaskollmer

Description

the program below (which shadows an integer generic parameter into an explicitly defined static property; see also #84027) will compile just fine (using swift 6.2), but emits a warning "redeclaration of 'count' is deprecated and will be an error in Swift 5 [#deprecation]".

which is nonsensical, since the program is being compiled with Swift 6.2; the warning stating that it "will be an error in Swift 5" implies that the compiler thinks it's a pre-swift 5 version.

Reproduction

protocol P {
    static var count: Int { get }
}

struct S<let count: Int>: P {
    static var count: Int { count }
    // ^ warning: redeclaration of 'count' is deprecated and will be an error in Swift 5 [#deprecation]
}

Expected behavior

this code either should not be required (if the integer generic parameter were compiled into a proper static property), or it should compile without a warning.

Environment

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx15.0

(from Xcode 26 beta 6)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions