Skip to content

Commit d8750a8

Browse files
committed
[CSSimplify] Allow l-value object simplication if l-value type is a placeholder
Placeholders propagate but we still can allow contextual inference, to facilitate that the solver should consider `l-value object` constraint to be solved and allow placeholders on "object" type.
1 parent 0a4ff7d commit d8750a8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ PotentialBindings::inferFromRelational(Constraint *constraint) {
15941594
if (type->isTypeVariableOrMember())
15951595
return std::nullopt;
15961596

1597-
type = LValueType::get(type);
1597+
type = LValueType::get(type);
15981598
} else {
15991599
// Right-hand side of the l-value object constraint can only
16001600
// be bound via constraint simplification when l-value type

lib/Sema/CSSimplify.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14178,6 +14178,14 @@ ConstraintSystem::simplifyLValueObjectConstraint(
1417814178
return type->is<LValueType>();
1417914179
};
1418014180

14181+
if (lvalueTy->isPlaceholder()) {
14182+
if (!shouldAttemptFixes())
14183+
return SolutionKind::Error;
14184+
14185+
recordAnyTypeVarAsPotentialHole(type2);
14186+
return SolutionKind::Solved;
14187+
}
14188+
1418114189
if (!isOrCanBeLValueType(lvalueTy)) {
1418214190
if (!shouldAttemptFixes())
1418314191
return SolutionKind::Error;

0 commit comments

Comments
 (0)