@@ -2388,12 +2388,7 @@ namespace {
2388
2388
bool bindPatternVarsOneWay,
2389
2389
PatternBindingDecl *patternBinding = nullptr ,
2390
2390
unsigned patternBindingIndex = 0 ) {
2391
- // If there's no pattern, then we have an unknown subpattern. Create a
2392
- // type variable.
2393
- if (!pattern) {
2394
- return CS.createTypeVariable (CS.getConstraintLocator (locator),
2395
- TVO_CanBindToNoEscape);
2396
- }
2391
+ assert (pattern);
2397
2392
2398
2393
// Local function that must be called for each "return" throughout this
2399
2394
// function, to set the type of the pattern.
@@ -4230,16 +4225,18 @@ bool ConstraintSystem::generateWrappedPropertyTypeConstraints(
4230
4225
// / Generate additional constraints for the pattern of an initialization.
4231
4226
static bool generateInitPatternConstraints (
4232
4227
ConstraintSystem &cs, SolutionApplicationTarget target, Expr *initializer) {
4233
- auto pattern = target.getInitializationPattern ();
4234
4228
auto locator = cs.getConstraintLocator (
4235
4229
initializer, LocatorPathElt::ContextualType (CTP_Initialization));
4236
- Type patternType = cs.generateConstraints (
4237
- pattern, locator, target.shouldBindPatternVarsOneWay (),
4238
- target.getInitializationPatternBindingDecl (),
4239
- target.getInitializationPatternBindingIndex ());
4240
4230
4241
- if (!patternType)
4242
- return true ;
4231
+ Type patternType;
4232
+ if (auto pattern = target.getInitializationPattern ()) {
4233
+ patternType = cs.generateConstraints (
4234
+ pattern, locator, target.shouldBindPatternVarsOneWay (),
4235
+ target.getInitializationPatternBindingDecl (),
4236
+ target.getInitializationPatternBindingIndex ());
4237
+ } else {
4238
+ patternType = cs.createTypeVariable (locator, TVO_CanBindToNoEscape);
4239
+ }
4243
4240
4244
4241
if (auto wrappedVar = target.getInitializationWrappedVar ())
4245
4242
return cs.generateWrappedPropertyTypeConstraints (
0 commit comments