nitra
nitra copied to clipboard
AST: "as" pattern in "when"- and "unless"-clause does not bind to the variable
Despite being declared in the when
-condition, the variable Foo1
is not actually visible and the compiler produces an error message. This happens with unless
as well.
using Nitra;
namespace Test
{
ast TestAst
{
when(Foo is Test.Foo as Foo1)
Error(context, "Cannot be Foo(" + Foo1.Integer + "), must be Bar."); // error : unbound name `Foo1'
out Foo : Test = Test.Foo(1);
}
}
namespace Test
{
public variant Test
{
| Foo { Integer : int; }
| Bar { Float : float; }
}
}