Skip to content

Nested tuple fails to perform label conversion in ternary expression #83806

@hamishknight

Description

@hamishknight

The following fails to compile with a bad diagnostic:

func foo(_ i: Int) {
  let _: (Int, (x: Int, Bool))? = true ? (i, (i, true)) : nil
  // error: type of expression is ambiguous without a type annotation
}

However if you remove the first element i and the associated Int from the type annotation, it succeeds. It also succeeds if you remove the ternary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselftuplesFeature: tuplestype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions