-
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
Clean up error messages for address of to non-function-pointer types. #44613
Conversation
* Correctly error on direct cast to non-func ptr type * Use better error message test. Fixes dotnet#44489.
@dotnet/roslyn-compiler @AlekseyTs for review of this small PR. |
It looks like there are legitimate test failures. #Closed |
Done with review pass (iteration 2) #Closed |
* Add additional tests. * Handle new GetTypeInfo case revealed by tests. * Rename variables for clarity.
@AlekseyTs addressed feedback. In reply to: 635197431 [](ancestors = 635197431) |
src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs
Outdated
Show resolved
Hide resolved
Done with review pass (iteration 3) #Closed |
@AlekseyTs this is ready for another look. |
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 5)
@@ -1806,6 +1806,8 @@ internal enum ErrorCode | |||
ERR_InvalidFuncPointerReturnTypeModifier = 8797, | |||
ERR_DupReturnTypeMod = 8798, | |||
ERR_AddressOfMethodGroupInExpressionTree = 8799, | |||
ERR_CannotConvertAddressOfToDelegate = 8800, | |||
ERR_AddressOfToNonFunctionPointer = 8801, |
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 error codes appear to be used already. (Most are used in master and 8801 is used in #44636.) #WontFix
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 already going to have to resolve conflicts here, one or two more isn't particularly more difficult.
In reply to: 432171912 [](ancestors = 432171912)
@@ -6160,4 +6160,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ | |||
<data name="OutIsNotValidForReturn" xml:space="preserve"> | |||
<value>'RefKind.Out' is not a valid ref kind for a return type.</value> | |||
</data> | |||
<data name="ERR_CannotConvertAddressOfToDelegate" xml:space="preserve"> | |||
<value>Cannot convert a & method group '{0}' to delegate type '{0}'.</value> |
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.
convert a & method group [](start = 18, length = 28)
This message uses "convert a & method group" while the message below uses "convert & method group". We should be consistent. Consider dropping the "a" since it's not clear whether it should be "a" or "an". #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.
Fixes #44489.