Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ast: handle boxing of erroneous and empty values gracefully #1795

Conversation

maxteufel
Copy link
Collaborator

Fixes #1765.

@michaellilltokiwa
Copy link
Member

This is another approach of fixing the bug, i.e. overriding the tagging for the used error value:

diff --git a/src/dev/flang/ast/Expr.java b/src/dev/flang/ast/Expr.java
index 5b53c73e..5427a9c4 100644
--- a/src/dev/flang/ast/Expr.java
+++ b/src/dev/flang/ast/Expr.java
@@ -602,6 +602,11 @@ public abstract class Expr extends ANY implements Stmnt
     NO_VALUE = new Call(SourcePosition.builtIn, Errors.ERROR_STRING)
     {
       { _type = Types.t_ERROR; }
+      @Override
+      Expr box(AbstractType frmlT)
+      {
+        return this;
+      }
     };
   }

@maxteufel maxteufel force-pushed the tagging-choice-with-error-gracefully branch from 12a5ed4 to 228159d Compare August 2, 2023 09:29
@maxteufel maxteufel changed the title ast: handle tagging of choice with erroneous values gracefully ast: handle boxing of erroneous and empty values gracefully Aug 2, 2023
@michaellilltokiwa michaellilltokiwa merged commit c05dde1 into tokiwa-software:main Aug 2, 2023
4 checks passed
@maxteufel maxteufel deleted the tagging-choice-with-error-gracefully branch August 2, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IndexOutOfBoundsException in Expr.tag
2 participants