Skip to content

[SR-10765] Dictionary(uniqueKeysWithValues:) in Dictionary extension causes error #53155

@swift-ci

Description

@swift-ci
Previous ID SR-10765
Radar None
Original Reporter maksg (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift 5.0

Xcode 10.2.1

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 4ef4648cb13e4d417b57984575a652b0

duplicates:

Issue Description:

extension Dictionary {
    
    func dict() {
        let digitWords = ["one", "two", "three", "four", "five"]
        let wordToValue = Dictionary(uniqueKeysWithValues: zip(digitWords, 1...5))
    }
    
}

The above code generates the following error:

Generic parameter 'Sequence1' could not be inferred

This can only be avoided by explicitly saying that I want to use Swift.Dictionary

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfexpressionsFeature: expressionsgenericsFeature: generic declarations and typesswift 6.0swift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposaltype checkerArea → compiler: Semantic analysistype inferenceFeature: type inferenceunexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions