Skip to content

[SR-7629] Wrong fixit when the type doesn't conform to a public protocol #50171

@swift-ci

Description

@swift-ci
Previous ID SR-7629
Radar None
Original Reporter sriharims (JIRA User)
Type Bug
Status In Progress
Resolution
Environment

Xcode 9.3, Swift 4.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug
Assignee None
Priority Medium

md5: 54986872b23e84cdf4f86614e935c40e

Issue Description:

This is my code without the protocol conformance

public struct Numbers: OptionSet
{

     public let rawValue: Int

     

     static let one = Numbers(rawValue: 1)

     static let two = Numbers(rawValue: 2)
}

The error message - Initializer 'init(rawValue:)' must be declared public because it matches a requirement in public protocol 'OptionSet' is correct, but the fixit inserts 'public' after 'struct' like this -

public struct public Numbers: OptionSet

Metadata

Metadata

Assignees

No one assigned

    Labels

    access controlFeature → modifiers: Access control and access levelsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesdiagnostics qualityBug: The quality of compiler diagnosticsfix-itsFeature: diagnostic fix-itsgood first issueGood for newcomersmemberwise initFeature: Memberwise structure initializerstype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions