Roslyn: Using declaration with β€˜_’ should be a discard

Created on 12 Apr 2020  Β·  4Comments  Β·  Source: dotnet/roslyn

Sharplab

β€˜using var _ = ...;’ currently introduces a local in scope and it can be accessed. β€˜_.ToString();’ should fail.

Tagging @chsienki

Reported on SO

Area-Compilers Bug New Language Feature - enhanced using

All 4 comments

I thought we had another issue tracking this already, but I can't seem to find it. We've talked a few times about allowing using discards, but I don't think we ever came to a concrete conclusion.

It seems like a fairly innocuous thing to allow, but we should check with LDM first.

Looking at the LDM notes, I see that we did get a decision: https://github.com/dotnet/csharplang/blob/master/meetings/2018/LDM-2018-12-03.md#discussion

Please scan those notes to check if anything else was left un-implemented.

This was also reported on csharplang over a year ago: dotnet/csharplang#2235

@chsienki I don't know what you think, but suspect that fixing this will be rather involved. Moving out to 16.9 Compiler.Nextt.

Was this page helpful?
0 / 5 - 0 ratings