-
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
Add Lock
object feature
#71716
Add Lock
object feature
#71716
Conversation
2cc133d
to
3ab200e
Compare
3ab200e
to
44d8808
Compare
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
Show resolved
Hide resolved
|
||
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics; | ||
|
||
public class LockTests : CSharpTestBase |
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.
/// before and after the body, respectively. | ||
/// Lowers a lock statement to a try-finally block that calls (before and after the body, respectively): | ||
/// <list type="bullet"> | ||
/// <item>Lock.EnterLockScope and Lock+Scope.Dispose if the argument is of type Lock, or</item> |
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.
It doesn't look like support for VB is implemented. It feels like we would want VB to recognize the new type as well, one way or another. |
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
Outdated
Show resolved
Hide resolved
We should check if |
Done with review pass (commit 1), new tests are not looked at. |
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
Outdated
Show resolved
Hide resolved
Done with review pass (commit 11) |
I haven't found any lock statement specific semantic model APIs. In reply to: 1907138198 |
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.
LGTM (commit 15). The remaining comments can be followed up on separately.
@cston @RikkiGibson for a second review, thanks. |
LGTM (commit 16) |
Test plan: #71888
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/lock-object.md
lock
on the newLock
type tousing
.Lock
toobject
/dynamic
/interface/base type.Lock.Scope
ref struct constraints - it cannot be used inusing
in async method.