Skip to content

Commit 1fa0179

Browse files
authored
Merge pull request #72353 from xedin/rdar-124549952
[CSSimplify] Mark all type variables in member type as holes if base …
2 parents 8a660a0 + b6ba3fe commit 1fa0179

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10733,8 +10733,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
1073310733
// reason to perform a lookup because it wouldn't return any results.
1073410734
if (shouldAttemptFixes()) {
1073510735
auto markMemberTypeAsPotentialHole = [&](Type memberTy) {
10736-
if (auto *typeVar = memberTy->getAs<TypeVariableType>())
10737-
recordPotentialHole(typeVar);
10736+
recordAnyTypeVarAsPotentialHole(simplifyType(memberTy));
1073810737
};
1073910738

1074010739
// If this is an unresolved member ref e.g. `.foo` and its contextual base

test/Constraints/members.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,3 +816,13 @@ func test_mismatch_between_param_and_optional_chain() {
816816
}
817817
}
818818
}
819+
820+
// rdar://124549952 - incorrect "type of expression is ambiguous without a type annotation"
821+
do {
822+
func fn() -> (any BinaryInteger)? {}
823+
824+
func test() {
825+
let _ = fn()?.op().value
826+
// expected-error@-1 {{value of type 'any BinaryInteger' has no member 'op'}}
827+
}
828+
}

0 commit comments

Comments
 (0)