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

[Improvement]: Provide code actions to fix non-private mutable fields #42314

Closed
nipunayf opened this issue Mar 14, 2024 · 0 comments · Fixed by #42341
Closed

[Improvement]: Provide code actions to fix non-private mutable fields #42314

nipunayf opened this issue Mar 14, 2024 · 0 comments · Fixed by #42341
Assignees
Labels
Area/CodeAction Language Server Code Actions Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement

Comments

@nipunayf
Copy link
Contributor

nipunayf commented Mar 14, 2024

Description

The fix for the diagnostic invalid non-private mutable field in an 'isolated' object(BCE3956) is straightforward, as we have to make the field private or make the field immutable. It would be convenient for a user if we could provide a code action as a quick fix for this use case.

Describe your problem(s)

No response

Describe your solution(s)

Consider the following source code with the respective diagnostic.

isolated class IsolatedClass {
    int i = 32;
}

FIX1: Allow the user to make the variable private.

isolated class IsolatedClass {
    private int i = 32; // changed
}

FIX2: Allow the user to make the variable immutable by making it final and readonly.

isolated class IsolatedClass {
    final int i = 32; // changed
}

Related area

-> Compilation

Related issue(s) (optional)

#28681

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@nipunayf nipunayf added Type/Improvement Team/LanguageServer Language Server Implementation related issues. #Compiler Area/CodeAction Language Server Code Actions labels Mar 14, 2024
@nipunayf nipunayf self-assigned this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAction Language Server Code Actions Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant