Skip to content

[CSSimplify] Mark all type variables in member type as holes if base … #72353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10739,8 +10739,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
// reason to perform a lookup because it wouldn't return any results.
if (shouldAttemptFixes()) {
auto markMemberTypeAsPotentialHole = [&](Type memberTy) {
if (auto *typeVar = memberTy->getAs<TypeVariableType>())
recordPotentialHole(typeVar);
recordAnyTypeVarAsPotentialHole(simplifyType(memberTy));
};

// If this is an unresolved member ref e.g. `.foo` and its contextual base
Expand Down
10 changes: 10 additions & 0 deletions test/Constraints/members.swift
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,13 @@ func test_mismatch_between_param_and_optional_chain() {
}
}
}

// rdar://124549952 - incorrect "type of expression is ambiguous without a type annotation"
do {
func fn() -> (any BinaryInteger)? {}

func test() {
let _ = fn()?.op().value
// expected-error@-1 {{value of type 'any BinaryInteger' has no member 'op'}}
}
}