-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix two array-related bugs in Microsoft.CSharp #17810
Conversation
// Add [] with (rank-1) commas inside | ||
ErrAppendChar('['); | ||
|
||
#if ! CSEE |
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.
Does anyone know what this CSEE
constant refers to?
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'm guessing the C# expression evaluator. Like below. @VSadov to confirm.
https://github.com/dotnet/corefx/blob/master/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs#L22
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.
In that case, we need to find out why would the result be different?
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.
In this case the CSEE behaviour is what I'd think would be correct for any case (except that it doesn't handle single-ranked non-SZ arrays but the assembly as a whole had no concept of SZ/non-SZ distinction before this PR).
In other cases I'm not sure what to do when I come across it.
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.
It appears to be pieces that supports Expression Evaluator that is used at debug time. They make no sense in the dynamic binder code.
I guess they were just ported together with the rest of the code. Perhaps the initial pass used some automated translator and it picked up everything, or it was expected that there would be a need for a special binder - specifically for EE to call into, but that need never materialized...
Anyways, I am not aware of any CSEE flavor of the runtime binder.
The "CSEE" seems just dead code and can/should be removed.
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 do that soon, so.
{ | ||
// Now we return an array of nesting level corresponding to the rank. | ||
ctype = _typeManager.GetArray(GetCTypeFromType(t.GetElementType()), t.GetArrayRank()); | ||
ctype = _typeManager.GetArray(GetCTypeFromType(t.GetElementType()), t.GetArrayRank(), t.IsSZArray); |
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 this use of IsSZArray
going to be safe when building for netstandard, or do I need to conditionally bring in a kludge for that case?
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.
Ah. It seems I need to kludge.
d[3] = 32; | ||
d[-1] = 28; | ||
Assert.Equal(32, d[3]); | ||
Assert.Equal(28, d[-1]); |
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.
This case is an interesting side-effect in that it's not possible to do compile the static equivalent, and yet the usage here seems reasonable and so not worth the explicit prohibition it would require to refuse it.
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.
Also, one can currently do the equivalent with non-zero-based arrays of higher ranks, so prohibiting it here would have to either be a breaking change to that or else inconsistent with it.
ef26e47
to
3f1ae36
Compare
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants> | ||
</PropertyGroup> | ||
<!-- Default configurations to help VS understand the configurations --> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" /> |
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 rest of the change seems ok, but not sure about the project/solution changes.
If we need that, perhaps make them a separate change?
@VSadov This is now exactly as it was except for the .sln, .csprog and .props files being unchanged. The |
As discussed at dotnet#17810 (comment)
As discussed at #17810 (comment)
Test Innerloop OSX10.12 Debug x64 Build and Test please |
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.
LGTM
Hey @JonHanna looks like the test
Would you mind in fixing it? You can repro by running:
|
Sure. I'm on phone right now, but should be able to get to my computer within the hour. |
Sounds good. Thanks |
As discussed at dotnet/corefx#17810 (comment) Commit migrated from dotnet/corefx@9326e91
Fix two array-related bugs in Microsoft.CSharp Commit migrated from dotnet/corefx@06f5653
Handle dynamic containing non-SZ single-rank arrays.
Fixes #17808
Correct names of array types in dynamic-related error messages.
Fixes #17809