Closed as not planned
Description
Bug Report
I get the following error when I add **init_kwargs
to the first overloaded function signature. If I remove it (but keep **init_kwargs
in all of the other function signatures), there's no error.
flax/linen/module.py:1664: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [misc]
flax/linen/module.py:1675: error: Overloaded function signature 3 will never be matched: signature 1's parameter type(s) are the same or broader [misc]
flax/linen/module.py:1686: error: Overloaded function signature 4 will never be matched: signature 1's parameter type(s) are the same or broader [misc]
To Reproduce
@overload
def param(
self, name: str, init_fn: Callable[..., T], *init_args, **init_kwargs,
) -> T:
...
@overload
def param(
self,
name: str,
init_fn: Callable[..., T],
*init_args,
unbox: Literal[True],
**init_kwargs,
) -> T:
...
@overload
def param(
self,
name: str,
init_fn: Callable[..., T],
*init_args,
unbox: Literal[False],
**init_kwargs,
) -> meta.AxisMetadata[T]:
...
@overload
def param(
self,
name: str,
init_fn: Callable[..., T],
*init_args,
unbox: bool,
**init_kwargs,
) -> Union[T, meta.AxisMetadata[T]]:
...
def param(
self,
name: str,
init_fn: Callable[..., T],
*init_args,
unbox: bool = True,
**init_kwargs,
) -> Union[T, meta.AxisMetadata[T]]:
Expected Behavior
Actual Behavior
Your Environment
- Mypy version used: mypy 1.8.0 (compiled: yes)
- Python version used: 3.9.6