I’m having problems getting my code to infer a return type correctly. Here’s a MWE:

```
using Test
struct TwoTo{N} end
@inline t(g::Base.Generator{<:TwoTo{N}, F}) where {N,F} = ntuple(i->g.f(i+1), Val{N-1}())
f(r) = t(t(i for i in r) for j in r)
Test.@inferred f(TwoTo{3}())
# ERROR: return type Tuple{Tuple{Int64,Int64},Tuple{Int64,Int64}} does not match inferred return type Tuple{Tuple{Any,Any},Tuple{Any,Any}}
```

If I change the definition of `t`

to:

```
@inline t(g::Base.Generator{<:TwoTo{N}, F}) where {N,F} = ntuple(g.f, Val{N-1}())
```

then type inference works (but the output is different, of course.)

I can’t figure out any way to wrap `g.f`

in a function in a way that does not destroy type inference. Any help would be appreciated!