Merge pull request #42036 from xedin/dont-infer-from-magic-defaults

[TypeChecker] SE-0347: Avoid type inference from caller-site defaults
This commit is contained in:
Pavel Yaskevich
2022-03-25 20:11:39 -07:00
committed by GitHub
4 changed files with 22 additions and 0 deletions

View File

@@ -1782,6 +1782,11 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
if (!PD->getInterfaceType()->hasTypeParameter())
continue;
// The type of the default value is going to be determined
// based on a type deduced for the parameter at this call site.
if (PD->hasCallerSideDefaultExpr())
continue;
auto defaultExprType = PD->getTypeOfDefaultExpr();
// A caller side default.