-
Notifications
You must be signed in to change notification settings - Fork 57
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
QuickFix for ValueNotContainedMutabilityLiteralConstantValuesDiffer #546
base: net233
Are you sure you want to change the base?
Changes from 1 commit
b5f622a
676ef15
3e7d62e
b94f311
243dc20
9c36e72
d6b0b5e
3139293
1cd7b7c
215b53a
38dd977
c2461c2
12c4470
eb494d3
cf75f65
3b96855
119aca3
e8d43c8
4cf1127
fc3f30a
9b12f36
71d8675
18b5e8c
35a4825
884e2a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,19 +19,18 @@ type UpdateLiteralConstantFix(error: LiteralConstantValuesDifferError) = | |
let tryFindSigBindingSignature sigMembers = | ||
sigMembers | ||
|> Seq.tryPick(fun m -> | ||
let bindingSignature = m.As<IBindingSignature>() | ||
match bindingSignature with | ||
| null -> None | ||
| _ -> | ||
match error.Pat.Binding.HeadPattern with | ||
| :? IReferencePat as implPat -> | ||
match bindingSignature.HeadPattern with | ||
| :? IReferencePat as sigRefPat when | ||
implPat.DeclaredName = sigRefPat.DeclaredName | ||
-> Some bindingSignature | ||
| _ -> None | ||
let bindingSignature = m.As<IBindingSignature>() | ||
match bindingSignature with | ||
| null -> None | ||
| _ -> | ||
match error.Pat.Binding.HeadPattern with | ||
| :? IReferencePat as implPat -> | ||
match bindingSignature.HeadPattern with | ||
| :? IReferencePat as sigRefPat when | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work with parens? [<Literal>]
let (a) = 1 Are there any other compound patterns that are allowed in a literal binding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. I can't think of one. Do you have another in mind? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could you check it, please? I.e. look at what kind of patterns are possible to type there, then check if analysis allows them to be in a literal binding. Looking at |
||
implPat.DeclaredName = sigRefPat.DeclaredName -> Some bindingSignature | ||
| _ -> None | ||
) | ||
| _ -> None | ||
) | ||
|
||
let mutable sigRefPat = null | ||
|
||
|
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 there a similar error produced for enum value declarations? If yes, we should try to make it easy to enable the same quick fix in all cases.
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.
I'll have a look at that.
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 error that is raised for enum values is also raised for record fields (FS193) and it's currently handled by
UpdateRecordFieldTypeInSignatureFix
. So I guess, we could expand that fix to also handle enums or merge it with the fix of this PR. Not sure yet, what's better.