type checker regression on 6.1 in subtyping rules for tuple labels
Open
Nobody has claimed this yet.
bug
implicit conversions
triage needed
type checker
- Dominant language
- Swift
- Stars
- 70.4k
- Forks
- 10.8k
- PR merge metrics
- PR metrics pending
Description
Description
Swift version 6.1 (swift-6.1-RELEASE)
Target: x86_64-unknown-linux-gnu
<stdin>:3:5: error: conflicting arguments to generic parameter 'Elements' ('[(Int, (b: Int, c: Int))]' vs. '[(Int, (Int, Int))]')
1 | func f()
2 | {
3 | for (a, (b, c)):(Int, (b:Int, c:Int)) in [(1, (2, 3))]
| `- error: conflicting arguments to generic parameter 'Elements' ('[(Int, (b: Int, c: Int))]' vs. '[(Int, (Int, Int))]')
4 | {
5 | }
<stdin>:3:58: error: conflicting arguments to generic parameter 'Self' ('[(Int, (b: Int, c: Int))]' vs. '[(Int, (Int, Int))]')
1 | func f()
2 | {
3 | for (a, (b, c)):(Int, (b:Int, c:Int)) in [(1, (2, 3))]
| `- error: conflicting arguments to generic parameter 'Self' ('[(Int, (b: Int, c: Int))]' vs. '[(Int, (Int, Int))]')
4 | {
5 | }
<stdin>:3:46: error: conflicting arguments to generic parameter 'Element' ('(Int, (b: Int, c: Int))' vs. '(Int, (Int, Int))')
1 | func f()
2 | {
3 | for (a, (b, c)):(Int, (b:Int, c:Int)) in [(1, (2, 3))]
| `- error: conflicting arguments to generic parameter 'Element' ('(Int, (b: Int, c: Int))' vs. '(Int, (Int, Int))')
4 | {
5 | }
Reproduction
func f()
{
for (a, (b, c)):(Int, (b:Int, c:Int)) in [(1, (2, 3))]
{
}
}
Expected behavior
it compiled on 6.0.3
Environment
Swift version 6.1 (swift-6.1-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided Swift snippet with Swift 6.1 and compare its result with Swift 6.0.3. Trace the type checker's subtyping and tuple-label handling for the annotated for-loop pattern. Done means the reproduction compiles without the conflicting generic-parameter diagnostics while preserving the expected tuple labels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100