@@ -5748,7 +5748,9 @@ func (c *Checker) getIteratedTypeOrElementType(use IterationUse, inputType *Type
5748
5748
// downlevelIteration is requested.
5749
5749
if uplevelIteration || downlevelIteration || allowAsyncIterables {
5750
5750
// We only report errors for an invalid iterable type in ES2015 or higher.
5751
+ fmt.Printf("DEBUG: getIteratedTypeOrElementType calling getIterationTypesOfIterable for use=%d\n", use)
5751
5752
iterationTypes := c.getIterationTypesOfIterable(inputType, use, core.IfElse(uplevelIteration, errorNode, nil))
5753
+ fmt.Printf("DEBUG: getIterationTypesOfIterable returned yieldType=%v\n", iterationTypes.yieldType != nil)
5752
5754
if checkAssignability {
5753
5755
if iterationTypes.nextType != nil {
5754
5756
var diagnostic *diagnostics.Message
@@ -5769,6 +5771,7 @@ func (c *Checker) getIteratedTypeOrElementType(use IterationUse, inputType *Type
5769
5771
}
5770
5772
if iterationTypes.yieldType != nil || uplevelIteration {
5771
5773
if iterationTypes.yieldType == nil {
5774
+ fmt.Printf("DEBUG: iterationTypes.yieldType is nil, returning nil\n")
5772
5775
return nil
5773
5776
}
5774
5777
if possibleOutOfBounds {
@@ -5900,10 +5903,13 @@ func (c *Checker) getIterationTypesOfIterable(t *Type, use IterationUse, errorNo
5900
5903
if IsTypeAny(t) {
5901
5904
return IterationTypes{c.anyType, c.anyType, c.anyType}
5902
5905
}
5906
+ fmt.Printf("DEBUG: getIterationTypesOfIterable called with use=%d, errorNode=%v\n", use, errorNode != nil)
5903
5907
key := IterationTypesKey{typeId: t.id, use: use&IterationUseCacheFlags | core.IfElse(errorNode != nil, IterationUseReportError, 0)}
5904
5908
if cached, ok := c.iterationTypesCache[key]; ok {
5909
+ fmt.Printf("DEBUG: getIterationTypesOfIterable cache hit\n")
5905
5910
return cached
5906
5911
}
5912
+ fmt.Printf("DEBUG: getIterationTypesOfIterable cache miss\n")
5907
5913
result := c.getIterationTypesOfIterableWorker(t, use, errorNode)
5908
5914
c.iterationTypesCache[key] = result
5909
5915
return result
0 commit comments