File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -632,6 +632,14 @@ class TypeVariableStep final : public BindingStep<TypeVarBindingProducer> {
632
632
bool attempt (const TypeVariableBinding &choice) override ;
633
633
634
634
bool shouldSkip (const TypeVariableBinding &choice) const override {
635
+ // Let's always attempt types inferred from "defaultable" constraints
636
+ // in diagnostic mode. This allows the solver to attempt i.e. `Any`
637
+ // for collection literals and produce better diagnostics for for-in
638
+ // statements like `for (x, y, z) in [] { ... }` when pattern type
639
+ // could not be inferred.
640
+ if (CS.shouldAttemptFixes ())
641
+ return false ;
642
+
635
643
// If this is a defaultable binding and we have found solutions,
636
644
// don't explore the default binding.
637
645
return AnySolved && choice.isDefaultable ();
You can’t perform that action at this time.
0 commit comments