Skip to content

Commit ab8b1cd

Browse files
authored
Merge pull request #78789 from xedin/fix-generic-arg-mismatch-with-leading-dot-syntax
[Diagnostics] Fix generic arguments mismatch diagnostic related to le…
2 parents f8dd132 + 798cd68 commit ab8b1cd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,8 @@ bool GenericArgumentsMismatchFailure::diagnoseAsError() {
10441044
break;
10451045
}
10461046

1047-
case ConstraintLocator::Member: {
1047+
case ConstraintLocator::Member:
1048+
case ConstraintLocator::UnresolvedMember: {
10481049
auto *memberLoc = getConstraintLocator(anchor, path);
10491050
auto selectedOverload = getOverloadChoiceIfAvailable(memberLoc);
10501051
if (!selectedOverload)

test/Concurrency/sendable_to_any_for_generic_arguments.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,17 @@ func test_subscript_computed_property_and_mutating_access(u: User) {
175175

176176
u.dict.testMutating() // Ok
177177
}
178+
179+
extension Dictionary where Key == String, Value == Any {
180+
init(age: Int) { // expected-note {{'init(age:)' declared here}}
181+
self.init()
182+
}
183+
}
184+
185+
extension User {
186+
convenience init(age: Int) {
187+
self.init()
188+
self.dict = .init(age: age)
189+
// expected-error@-1 {{referencing initializer 'init(age:)' on '[String : any Sendable].Type' requires the types 'any Sendable' and 'Any' be equivalent}}
190+
}
191+
}

0 commit comments

Comments
 (0)