Support Range for non ValueTuple by remove the GetOffsetAndLength method
wherewhere opened this issue · 5 comments
Description (optional)
Support Range
for non ValueTuple
by remove the GetOffsetAndLength
method
Rationale
Code like "Hello World"[..5]
does not need to use Range
. It just be compiled to "Hello World".Substring(0, 5)
. So please remove GetOffsetAndLength
when ValueTuple
is not referenced like this Range.cs.
Things like (a, b) = (b, a)
does not need to use ValueTuple
. Why they have to check ValueTuple
existing?
Things like
(a, b) = (b, a)
does not need to useValueTuple
. Why they have to checkValueTuple
existing?
The final codegen of swapping variables not using ValueTuple
due to optimization doesn't mean the compiler won't check the existence of ValueTuple
to make sure the ValueTuple
feature itself works. And the compiler still needs to get the type ValueTuple
so that it can bind the symbols, otherwise the type of (a, b)
and (b, a)
will be unknown at compile time.
But (a, b) = (b, a)
can't be ValueTuple
. Create ValueTuple
need (var c, var d) = (b, a)
. Distrust (a, b) = c
seems not check ValueTuple
.
You are trying to construct a ValueTuple at the right expression (b, a)
, but as for (a, b) = c
where (a, b)
is on the left, it is a completedly unrelated feature called destruction.
...