Skip to content

Commit

Permalink
ast: fix check-failure if redefinition is a choice
Browse files Browse the repository at this point in the history
This problem occures in fuzion-lang.dev's design/exmaples/red_choice.fz example.
With this patch, a proper error is produced.
  • Loading branch information
fridis committed May 17, 2024
1 parent 1932286 commit 19315f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dev/flang/ast/AstErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,12 @@ else if (existing.isChoice())
{
cannotRedefineChoice(f, existing);
}
else if (f.isChoice())
{
cannotRedefine(f.pos(), f, existing,
"Redefinition cannot be a choice",
"To solve this, re-think what you want to do. Maybe define a new choice type with a different name instead.");
}
else if (existing.isConstructor() || f.isConstructor())
{
cannotRedefine(f.pos(), f, existing,
Expand Down

0 comments on commit 19315f7

Please sign in to comment.