-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit special warning when = is used and user might want to use <-
- Loading branch information
Showing
11 changed files
with
141 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ource/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhereRequiresParens01.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// #Warnings | ||
//<Expects status="Warning" span="(8,5)" id="FS0020">The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</Expects> | ||
|
||
let x = 10 | ||
let y = 20 | ||
|
||
let changeX() = | ||
y * x = 20 | ||
y = 30 | ||
|
||
exit 0 |
11 changes: 11 additions & 0 deletions
11
tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// #Warnings | ||
//<Expects status="Warning" span="(8,5)" id="FS0020">If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'.</Expects> | ||
|
||
let x = 10 | ||
let y = "hello" | ||
|
||
let changeX() = | ||
x = 20 | ||
y = "test" | ||
|
||
exit 0 |
11 changes: 11 additions & 0 deletions
11
tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// #Warnings | ||
//<Expects status="Warning" span="(8,5)" id="FS0020">If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'.</Expects> | ||
|
||
let mutable x = 10 | ||
let y = "hello" | ||
|
||
let changeX() = | ||
x = 20 | ||
y = "test" | ||
|
||
exit 0 |
13 changes: 13 additions & 0 deletions
13
tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// #Warnings | ||
//<Expects status="Warning" span="(10,5)" id="FS0020">If you intended to set a value to a property, then use the '<-' operator e.g. 'x <- expression'</Expects> | ||
|
||
open System | ||
|
||
let x = System.Timers.Timer() | ||
let y = "hello" | ||
|
||
let changeProperty() = | ||
x.Enabled = true | ||
y = "test" | ||
|
||
exit 0 |
15 changes: 15 additions & 0 deletions
15
tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// #Warnings | ||
//<Expects status="Warning" span="(12,5)" id="FS0020">If you intended to set a value to a property, then use the '<-' operator e.g. 'x <- expression'</Expects> | ||
|
||
type MyClass(property1 : int) = | ||
member val Property1 = property1 | ||
member val Property2 = "" with get, set | ||
|
||
let x = MyClass(1) | ||
let y = "hello" | ||
|
||
let changeProperty() = | ||
x.Property1 = 20 | ||
y = "test" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters