This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Default values on parameters should not force the parameter type #1237
Open
Description
Take:
def add(a=1, b=2):
return a + b
With x = add()
, we get int
. But, with y = add("a", "b")
, we also get int
.
The presence of a default value doesn't necessarily mean that is what is going to be passed in. The second example should have the opportunity to evaluate with both strings and end up with a final string.
The old LS could "do" this, but only because all possible input and output types were unioned together (giving the appearance of the return type making sense).