-
Notifications
You must be signed in to change notification settings - Fork 847
Infer string type when using nameof pattern #14065
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
Conversation
|
Hi, had a look at the failing checks: https://dev.azure.com/dnceng-public/public/_build/results?buildId=46781&view=logs&j=966222a4-f29d-5ec0-88cc-1b798728906e&t=052eabf8-67e2-5f29-745c-00cc34aa0e02 is hinting two failing tests related to this change: at FSharp.Tests.Core.VersionTests.nameof-fsi() in D:\a_work\1\s\tests\fsharp\tests.fs:line 2102 and at FSharp.Tests.Core.VersionTests.nameof-execute() in D:\a_work\1\s\tests\fsharp\tests.fs:line 2099 This should bring you to test cases where a new regression was introduced, please try to untackle this. |
|
@T-Gro Unfortunately, when I am running the same code with |
|
How did you run the same code please? Or, alternatively, run Build.cmd with respective -test*** switch, this is what CI does. |
|
Yes, I did that and in my local env it also fails. |
This specific is calling dotnet.exe with |
|
Ok, thanks, I look into this. Update: Unfortunately I cannot solve this, the test continues to fail, but all the nameof resolutions seems to produce the correct const string. I don't have the required knowledge to find what is wrong :( |
8d51296 to
e759f26
Compare
Please keep it, I do want to have this working too. I would love to help more, but from purely looking at it I do not have any ideas nor tips. |
|
I think I got the issue now, will submit soon. The Const.ToString() is a debug-oriented view, and therefore adds quotes around the string when rendering it. Which then meant that the pattern did not match. I have also replaced the code to be more strict and insist on Const.String, since nameof should not produce any other constant type besides a string. |
Fixing nameof pattern matching by avoiding .ToString(), which is a debug-oriented representation that adds double quotes to the string. Which then meant a difference between string itself and then one being matched. Also adding a case to the component tests suite to cover for this.
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
psfinaki
left a comment
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.
Most likely there is a better way to do this, any comment appreciated
Fixes: #13377
PS: I am a c# dev, it's my first time with f#, I would like to implement better
(SynConst.String(c.ToString(), SynStringKind.Regular, m))but I dont know how