-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Adding ioperation tests for ForEachStatement #21048
Adding ioperation tests for ForEachStatement #21048
Conversation
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_WithYeild() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Yield
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_Struct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this equivalent to the earlier Array
tests? If so, consider removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_ConstantNull() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming since the string is not null. Perhaps just IForEachLoopStatement_String
.
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_ForEachOutVar() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does out var i
affect the IForEachLoopStatement
? If not, consider removing the test.
public static implicit operator C(string s) | ||
{ | ||
return new C(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion operator is unused.
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_Withhrow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: WithThrow
Class Program | ||
Public Shared Sub Main() | ||
Const s As String = Nothing | ||
For Each y In TryCast(s, String)'BIND:"For Each y In TryCast(s, String)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TryCast
is not necessary.
Return New Integer() {1, 2, 3}.GetEnumerator() | ||
End Function | ||
End Structure | ||
]]>.Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code above does not include a query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
End Sub | ||
|
||
<Fact(), WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")> | ||
Public Sub IForEachLoopStatement_InvalidConverstion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Conversion
3c62d20
to
1d061b9
Compare
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_WithYield() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yield
only affects the implementation of IEnumerable<T>
, not the foreach
. Consider removing test or replacing IForEachLoopStatement_WithList
since both are testing IEnumerable<T>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
} | ||
|
||
[Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] | ||
public void IForEachLoopStatement_Nested() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IForEachLoopStatement
does not depend on the content of Body
so the inner foreach
should not affect the outer foreach
. Consider removing the tests of nested foreach
.
End Sub | ||
|
||
<Fact(), WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")> | ||
Public Sub IForEachLoopStatement_Nested() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing nested For Each
tests since the statements in the Body
should not affect the IForEachLoopStatement
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
End Sub | ||
|
||
<Fact(), WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")> | ||
Public Sub IForEachLoopStatement_FuncCall() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_FuncCall
test should be covered by other array tests.
LGTM |
test windows_debug_unit32_prtest |
test windows_release_vs-integration_prtest |
…sion-expression-rewrite * dotnet/features/ioperation: (229 commits) Adding Ioperation tests for WhileUntilLoopStatement (dotnet#21047) marked assert that needs to be re-enabled addressing more PR feedbacks PR feedback Remove InvocationReasons enum boxing PR feedbacks Expose if a Binary/Unary operator was 'Lifted' at the IExpression level. (dotnet#14779) addressing PR feedback added comments Update VS Integration machines to 15.3 Preview 6 (dotnet#21240) fixed typo Fixed dotnet#18763 Compiler crash on bad code in the IDE (dotnet#20903) Fix typo in ERR_RefReturnParameter2 (dotnet#21235) Fix unbound recursion with const var field in script (dotnet#21223) Typo fix (dotnet#20513) PR feedbacks and added some more tests When producing character literals, surrogate characters should be escaped. (dotnet#20720) Fix build correctness issues Fix possible null reference warnings Adding ioperation tests for ForEachStatement (dotnet#21048) ...
Part of #17602
cc @dotnet/analyzer-ioperation , @cston