Closed auduchinok closed 2 years ago
Interestingly, in FSAC it's reported as unused:
But the compiler definitely ignores x2
:
/Users/phillip/scratch/console/Program.fs(6,9): warning FS1182: The value 'x1' is unused [/Users/phillip/scratch/console/console.fsproj]
/Users/phillip/scratch/console/Program.fs(10,14): warning FS1182: The value 'x3' is unused [/Users/phillip/scratch/console/console.fsproj]
/Users/phillip/scratch/console/Program.fs(15,10): warning FS1182: The value 'argv' is unused [/Users/phillip/scratch/console/console.fsproj]
/Users/phillip/scratch/console/Program.fs(16,9): warning FS1182: The value 'x' is unused [/Users/phillip/scratch/console/console.fsproj]
4 Warning(s)
@Krzysztof-Cieslak any ideas why this would report correctly in Ionide?
@Krzysztof-Cieslak any ideas why this would report correctly in Ionide?
@cartermp Please note it's about binding in a CE, i.e. when use!
is used. The warning about x2
looks like a bug in Ionide/FSAC.
I see, sorry. Looks I misread this as use
and was confused about why use!
was emphasized in your screenshot.
Worse yet, the use!
binding cannot be the wildcard pattern _
.
d
use! d = async { return { new IDisposable with member x.Dispose() = () } }
FS1182: The value is unused
_
use! _ = async { return { new IDisposable with member x.Dispose() = () } }
FS1228:
use!
bindings must be of the formuse! <var> = <expr>
Worse yet, the
use!
binding cannot be the wildcard pattern_
.
I always use __
(double underscores). That works fine and communicates the same intent. Until recently the same thing was required for this
in instance members, e.g. member __.Foo = ...
(now you can write member _.Foo
).
Nice comparison.
I just wanted to add that information to this issue. I would not like if this issue were fixed in such a way that the identifier caused FS1182
(the unused value warning) and it was still not possible to use the discard pattern.
I checked and this is now consistent in VS2022 - must have been fixed somewhere along the way