Skip to content

[SR-14285] Generic typealiases don't constrain their known types in extensions #56644

Closed as duplicate of#55263
@hartbit

Description

@hartbit
Previous ID SR-14285
Radar rdar://problem/74876586
Original Reporter @hartbit
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 45637aa4240ad1b88bdac3d67539c4b1

Issue Description:

I would expect the following code to compile and to define a secondUppercased property on all Tuple where the U type is a String.

struct Tuple<T, U> {
    let first: T
    let second: U
}

extension Tuple where U == String {
    var secondLowercased: String {
        second.lowercased()
    }
}

typealias TupleString<T> = Tuple<T, String>

extension TupleString {
    var secondUppercased: String {
        second.uppercased()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions