You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we add certain type annotations, which are correct, the check stage complains.
We know they are correct, however, in the current implementation because the output does actually have these unions.
How to Reproduce
Give as input:
class MyClass
def __str__() -> String => "M"
def a := if True then 20 else MyClass()
print(a)
class MyClass
def __str__() -> String => "M"
def a: Union[Int, MyClass] := if True then 20 else MyClass()
print(a)
We get the following:
Error: Expected an Union[Int, MyClass], was an Int
──→ assign_with_if_different_types.mamba:4:47
4 | def a: Union[String, MyClass] := if True then 20 else MyClass()
^^
└─→ variable and expression: `if`
4 | def a: Union[String, MyClass] := if True then 20 else MyClass()
Expected behavior
The check stage should pass.
Perhaps this is a quick fix by flipping around the constraint in the variable definition generation stage/function.
Additional context
Putting in milestone 3.7.0 in case this is a non-trivial fix.
It not a critical error, but if it is an easy fix would be nice to have for 3.6.0
The text was updated successfully, but these errors were encountered:
Description of Bug
When we add certain type annotations, which are correct, the check stage complains.
We know they are correct, however, in the current implementation because the output does actually have these unions.
How to Reproduce
Give as input:
Which gives output
However, if we give input
We get the following:
Expected behavior
The check stage should pass.
Perhaps this is a quick fix by flipping around the constraint in the variable definition generation stage/function.
Additional context
Putting in milestone 3.7.0 in case this is a non-trivial fix.
It not a critical error, but if it is an easy fix would be nice to have for 3.6.0
The text was updated successfully, but these errors were encountered: