-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed as duplicate of#44398
Closed as duplicate of#44398
Copy link
Labels
TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesswift 6.0swift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposaltype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inferenceunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Previous ID | SR-4155 |
Radar | None |
Original Reporter | @dabrahams |
Type | Bug |
Status | Resolved |
Resolution | Duplicate |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 2f198f51481b5b4892e90af8f01334c2
duplicates:
Issue Description:
This should work, but doesn't:
(swift) struct X<T> {
init(_: T) {}
func f() {
print(X(3))
}
}
<REPL Input>:4:13: error: 'Int' is not convertible to 'T'
print(X(3))
~^~
(swift)
The problem is that inside X
, all mentions of X
without explicit generic parameters are assumed to be Self, rather than only using that deduction as a last resort. It's very inconvenient in my particular use-case!
Metadata
Metadata
Assignees
Labels
TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesswift 6.0swift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposaltype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inferenceunexpected errorBug: Unexpected errorBug: Unexpected error