[Improvement]: Provide a quick-fix code action for invalid transfer out of a lock statement #42333
Labels
Area/CodeAction
Language Server Code Actions
Team/LanguageServer
Language Server Implementation related issues. #Compiler
Type/Improvement
Milestone
Description
For the diagnostic
invalid attempt to transfer out a value from a 'lock' statement with restricted variable usage: expected an isolated expression
, there are common fixes in which you can either return a clone of the selected value or make the respective data storage immutable. All these CAs should be provided to the user so that they can make the decision based on their use case.Describe your problem(s)
No response
Describe your solution(s)
Consider the following source code with the respective diagnostic.
FIX1: Make the data structure immutable, assuming there are no updates to the storage.
FIX2: Clone the value expression, and let the caller manipulate the cloned value.
FIX3: Clone the value expression, and disallow the caller to manipulate the cloned value.
Related area
-> Compilation
Related issue(s) (optional)
#28681
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: