-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept PE Operator Symbols having in parameters #23508
Accept PE Operator Symbols having in parameters #23508
Conversation
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
Thanks!!
!this.IsParams(); | ||
private bool IsValidUserDefinedOperatorSignature(int parameterCount) | ||
{ | ||
if (this.ReturnsVoid || this.IsGenericMethod || this.IsVararg || this.ParameterCount != parameterCount || this.IsParams()) |
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.
Please enter a bug on rejecting ref-returning operators (defined in IL). It seems we have always allowed them, so there could be compat concerns.
Also it is not clear whether they "just worked", or were broken anyways. #Resolved
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.
@dotnet/roslyn-compiler can I get another view? #Closed |
}"; | ||
|
||
CompileAndVerify(code, additionalRefs: new[] { reference.ToMetadataReference() }, expectedOutput: "3"); | ||
CompileAndVerify(code, additionalRefs: new[] { reference.EmitToImageReference() }, expectedOutput: "3"); |
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.
Should we have tests to ensure that we import both the in
and normal operators? That should result in an ambiguity error (as discussed in LDM) but we should have a test for it. #Pending
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.
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.
@jaredpar can you please comment on the LDM decision?
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.
You are correct: we prefer the val version here. I had the LDM decision backward when I made my comment.
Should any changes be made for VB? #Closed |
{ | ||
public int Value { get; set; } | ||
|
||
public static int operator +(in Test a, in Test b) |
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.
public static int operator +(in Test a, in Test b) [](start = 4, length = 50)
Please add a test for scenarios when in
is only on the left and in
is only on the right. #Closed
Done with review pass (iteration 1) #Closed |
I don't think there are any plans to support them for now. I've added tests nonetheless. In reply to: 349390415 [](ancestors = 349390415) |
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 (iteration 2).
@MeiChin-Tsai for ask mode approval. |
Approved. Please make sure all checks are green. |
test ubuntu_14_debug_prtest please |
ubuntu_16_debug_prtest failed with error below. FYI @dotnet/roslyn-infrastructure I'll re-run. ```/tmp/jenkins4339886900905968752.sh: 2: /tmp/jenkins4339886900905968752.sh: ./build/scripts/cibuild.sh: Permission denied` |
test ubuntu_16_debug_prtest please |
Ubuntu issue seems persistent |
@dotnet/roslyn-infrastructure is this a known issue? |
@dotnet-bot test ubuntu_14_debug_prtest |
@khyperia did you make sure to mark that script as executable? |
@jaredpar that seems to be a very odd diff. I'll rebase and make sure it is out of the commit. |
It's definitely executable in latest master, pretty sure it's been that way... |
Ah, yeah, this PR has this: (I assume that's what @OmarTawfik meant with their latest comment) |
Thanks @khyperia . Something wrong went in that merge. Rebased and should be passing now. |
Customer scenario
Expected: prints 9
Actual: CS0019: Operator '+' cannot be applied to operands of type 'Test' and 'Test'
Bugs this fixes
Fixes devdiv bug 530136 (feedback link)
Workarounds, if any
None needed
Risk
Low.
Performance impact
None.
Is this a regression from a previous update?
No.
Root cause analysis
It was an implementation detail in how C# compiler imports symbols from other binaries. Now fixed.
The compiler would ignore operators that have parameters with any ref kind.
How was the bug found?
Customer report.
Test documentation updated?
No.