Add test for using case statement inside if statement.#919
Merged
Conversation
Collaborator
Author
|
This test generates following output public static int main()
{
int result = 41;
int num = 3;
int num2 = 0;
int num3 = num;
if (num3 != 3)
{
if (num3 == 2)
{
goto IL_0033;
}
}
else if (num2 != 0)
{
goto IL_0033;
}
goto IL_0042;
IL_0074:
int num4 = num4 + 1;
goto IL_0083;
IL_0083:
return result;
IL_0033:
num4++;
goto IL_0042;
IL_0042:
num = 2;
int num5 = num;
if (num5 != 3)
{
if (num5 == 2)
{
goto IL_0074;
}
}
else if (num2 != 0)
{
goto IL_0074;
}
goto IL_0083;
}Notice |
Collaborator
Author
|
Based on diagnostics, lowering and graph transformation seems to be preserve code semantics. I'ts emit phase probably which is broken. This is sample of code which we are sending to Emitter |
8d30c52 to
b7fad0d
Compare
Collaborator
Author
|
Probably we have issues somewhere in the Linearization phase. After it, all EmitScope should be empty. When I set assert, it fails only in new test. If PR sits for too long probably good to merge and create issue asking to add Debug.Assert(s.EmitScope == null || s.EmitScope == scope, "EmitScope should be function scope after Lineralize");in the |
In this case additional variables generated
5580ccf to
49a4079
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.