-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Description
I have a function with this signature:
def get_value(self)-> Union[NoneType, bool, i32, i64, float, str]:
Sometime this function returns None
When this happens, printing a returned value results in this :
ValueError: optional unpack failed: expected Union[Int[32] | Int[64] | NoneType | bool | float | str], got None
Raised from: std.internal.types.optional.unwrap.0:0
/Users/yfinkelstein/.codon/lib/codon/stdlib/internal/types/optional.codon:99:5
Is there a better way to model a return type that has a nuber of type alternatives or None ?
Also, another strange behavior:
if the function does not return anything ( a branch that does not have a return statement and just exits), the returned value has the type of the first template type in the Union after sorting by type name
Metadata
Metadata
Assignees
Labels
No labels