Support `CallerArgumentExpression`
Description
Implements fsharp/fslang-suggestions#966, #18489
RFC FS-1149-support-CallerArgumentExpression.md, FS-1332-assert-keyword-enhancement.md
Checklist
- [x] Test cases added
- [ ] Performance benchmarks added in case of performance changes
- [x] Release notes entry updated:
:heavy_exclamation_mark: Release notes required
:white_check_mark: Found changes and release notes in following paths:
Change path Release notes path Description LanguageFeatures.fsidocs/release-notes/.Language/preview.md
Here I encounter a problem about #line. For example, the code is saved in D:\Program.fs:
#1 "C:\\Program.fs"
System.ArgumentNullException.ThrowIfNullOrWhiteSpace(" ") // will failed to build
// And more complicated case, repeat the file name and line number
#1 "C:\\Program.fs"
System.ArgumentNullException.ThrowIfNullOrWhiteSpace(" ") // will failed to build
So here I want to get the original range instead of a range modified by #line . Is there anybody know how to do it?
Thank you @ijklam , this looks good. Please follow https://github.com/dotnet/fsharp/blob/e4950e6c3f4f7e9829dd86f127a0e7cf54d9220e/DEVGUIDE.md?plain=1#L266 to verify and update the ilverify baselines, since some changes have been detected for this PR.
I will review this PR more deeply later this week.
There are some problem with the #line therefore turn it into draft.
This is ready for both the fsc and fsi, but may not work properly with the #line directive.
The #line directive processing needs LineMaps of #18049 to be available.
I propose to merge this in as is with the #line limitation, afterall it is a construct for code generators.
This PR does come under a LanguageFeature flag and we could offer the feature for real world testing under the preview version.
Hi there, I've make some efforts to make it get the source code from the LexBuffer and pass it to the cenv. Now it won't read files twice, and some parser functions in ParseAndCheckInputs.fs now return ParsedInput * ISourceText option, some checker functions also need a ISourceText option as input.
I created a new field cenv.SourceText: ISourceText option besides the cenv.tcSink.CurrentSink.CurrentSourceText to store the source content, as the cenv.tcSink is seems to be used only in language service scenario.
Turn this into draft until we make it compatible with the #lines.
@T-Gro Hi there, I cannot access the Azure to see the test result. Could you please grant me the permission?
The page said:
The selected user account does not exist in the tenant "Microsoft" and cannot access the application "499b84ac-1321-427f-aa17-267ca6975798" in that tenant. You need to add the account as an external user of the tenant first. Please use a different account.
@ijklam I see there are some timeouts in .Net Framework test runs, probably the cause is this https://github.com/dotnet/fsharp/pull/18875, so unrelated to your code. (threadpool starvation likely).