-
Notifications
You must be signed in to change notification settings - Fork 833
Description
In #11482 I introduced a new SynConst union to capture SourceIdentifiers.
By doing this I've introduced a change in the parser that breaks the detection of a hashDirectiveArg that will lead to the creation of ParsedHashDirective.
In short, source identifiers will not be picked anymore when they are part of the ParsedHashDirective args.
Repro steps
Provide the steps required to reproduce the problem:
The following code:
#I __SOURCE_DIRECTORY__will lead to the follow AST:
HashDirective (ParsedHashDirective ("I", [], range), range)Expected behavior
The original behavior in FCS 39 would be
HashDirective (ParsedHashDirective ("I", ["D:\home\site\wwwroot"], range), range)Actual behavior
The arguments are empty and when running this in fsi you get:
error FS0010: Unexpected compiler generated literal in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Known workarounds
Well, in the case this is used in FSI, you could first evaluate __SOURCE_DIRECTORY__ and then use the output as constant.
Related information
I would volunteer to fix this issue as it is my own doing. Again apologies for this.
To solve this, I would like to introduce a new type ParsedHashDirective to capture all information.
type ParsedHashDirectiveArgument =
| String of value: string * range: Range
| SourceIdentifier of constant: string * value: string * range: RangeProvide any related information (optional):
- Operating system: Windows
- .NET Runtime kind (.NET Core, .NET Framework, Mono): dotnet 5.0.300
- Editing Tools (e.g. Visual Studio Version, Visual Studio): FCS 40