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

Different data type in case statement #40

Closed
broncha opened this issue Dec 27, 2017 · 6 comments
Closed

Different data type in case statement #40

broncha opened this issue Dec 27, 2017 · 6 comments
Assignees

Comments

@broncha
Copy link
Contributor

broncha commented Dec 27, 2017

When cases in expressions are of different data type, currently we are only looking at the first one. This causes issues when we have different types.
eg. text type in case 0 and enumset in case 1.

If the second condition is met, the enum values are not transformed

@broncha broncha self-assigned this Dec 27, 2017
@grassick
Copy link
Member

I can't imagine why a case would want to return two different datatypes. The expressions system doesn't support variable type expressions and I think the first case should define the type for the subsequent ones. I believe that's how getExprType figures out the type of case expressions.

@broncha
Copy link
Contributor Author

broncha commented Dec 27, 2017

here is the case that brought this up. The if statement is a text type and else is enumset
Works as expected when the cases are reversed. That's the solution I replied to him.

screen shot 2017-12-27 at 12 06 15 pm

@grassick
Copy link
Member

grassick commented Dec 27, 2017 via email

@broncha
Copy link
Contributor Author

broncha commented Jan 4, 2018

Yes "Baye defon" is an enum set. But since the first case is a text type. Its treated as text, and the ids of the enum values from "Baye defon" are shown.

@grassick
Copy link
Member

grassick commented Jan 8, 2018

Ya, definitely shouldn't be allowed. All later "thens" should be forced to be same type as first.

There is a "Convert to text" function for cases like this where an enum needs to become a plain text string.

@broncha
Copy link
Contributor Author

broncha commented Jan 10, 2022

closed with the updates here #63

@broncha broncha closed this as completed Jan 10, 2022
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

No branches or pull requests

2 participants