-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfimprovementtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
| Previous ID | SR-13965 |
| Radar | rdar://problem/45735133 |
| Original Reporter | @typesanitizer |
| Type | Improvement |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Improvement, TypeChecker |
| Assignee | None |
| Priority | Medium |
md5: 5db23a1c00e99b556cb85597f6d03045
Issue Description:
We allow shadowed type parameters, which can lead to confusing diagnostics.
struct S<T> {
var t: T
init<T>(_ myT : T) {
t = myT // error: cannot assign value of type 'T' to type 'T'
}
}In this case, there are two rigid type variables, one for the outer parameter and one for the inner parameter, but since they are both rigid, they can't be equal.
Emitting a warning would guide the programmer to simplifying their code so that we can produce a better diagnostic.
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfimprovementtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis