Skip to content

Commit 7143203

Browse files
authored
Merge pull request swiftlang#66579 from xedin/allow-holes-in-diagnostic-mode-only
[ConstraintSystem] Allow generic parameters to bind to holes only in …
2 parents 5125ede + cfbbb28 commit 7143203

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,11 +1868,14 @@ TypeVariableType *ConstraintSystem::openGenericParameter(
18681868
auto *paramLocator = getConstraintLocator(
18691869
locator.withPathElement(LocatorPathElt::GenericParameter(parameter)));
18701870

1871-
unsigned options = (TVO_PrefersSubtypeBinding |
1872-
TVO_CanBindToHole);
1871+
unsigned options = TVO_PrefersSubtypeBinding;
1872+
18731873
if (parameter->isParameterPack())
18741874
options |= TVO_CanBindToPack;
18751875

1876+
if (shouldAttemptFixes())
1877+
options |= TVO_CanBindToHole;
1878+
18761879
auto typeVar = createTypeVariable(paramLocator, options);
18771880
auto result = replacements.insert(std::make_pair(
18781881
cast<GenericTypeParamType>(parameter->getCanonicalType()), typeVar));

0 commit comments

Comments
 (0)