guppylang
guppylang copied to clipboard
Allow nested functions to refer to type parameters of the outer function
@guppy
def main[T]() -> None:
def bar() -> None:
x: Option[T] = nothing()
This should also fix #1036.
To do this, the inner function should inherit all type params of the outer function. Then we immediately type-apply the bound variables of the outer function
- This is very hard, that's why we didn't do it
- We don't have nested functions anymore
I'm not suggesting any change to Hugr, this should be a pure frontend feature