@@ -3935,14 +3935,13 @@ bool ConstraintSystem::generateConstraints(
39353935 return true ;
39363936
39373937 auto init = patternBinding->getInit (index);
3938- if (!init) {
3939- llvm_unreachable (" Unsupported pattern binding entry" );
3940- }
39413938
3942- // Generate constraints for the initialization.
3943- auto target = SolutionApplicationTarget::forInitialization (
3944- init, dc, patternType, pattern,
3945- /* bindPatternVarsOneWay=*/ true );
3939+ auto target = init ? SolutionApplicationTarget::forInitialization (
3940+ init, dc, patternType, pattern,
3941+ /* bindPatternVarsOneWay=*/ true )
3942+ : SolutionApplicationTarget::forUninitializedVar (
3943+ patternBinding, index, pattern, patternType);
3944+
39463945 if (generateConstraints (target, FreeTypeVariableBinding::Disallow)) {
39473946 hadError = true ;
39483947 continue ;
@@ -3963,9 +3962,20 @@ bool ConstraintSystem::generateConstraints(
39633962
39643963 return generateWrappedPropertyTypeConstraints (
39653964 *this , /* initializerType=*/ Type (), wrappedVar, propertyType);
3966- }
3965+ } else {
3966+ auto pattern = target.getAsUninitializedVar ();
3967+ auto locator = getConstraintLocator (
3968+ pattern, LocatorPathElt::ContextualType (CTP_Initialization));
3969+
3970+ // Generate constraints to bind all of the internal declarations
3971+ // and verify the pattern.
3972+ Type patternType = generateConstraints (
3973+ pattern, locator, /* shouldBindPatternVarsOneWay*/ true ,
3974+ target.getPatternBindingOfUninitializedVar (),
3975+ target.getIndexOfUninitializedVar ());
39673976
3968- llvm_unreachable (" Unsupported un-initialized variable" );
3977+ return !patternType;
3978+ }
39693979 }
39703980 }
39713981}
0 commit comments