Closed Smaug123 closed 1 month ago
@safesparrow @nojaf any pointers where I could look at? If not, I'll debug it later this week or next week
Same error can be seen in IDE with Transparent Compiler enabled.
Exception's identifier "Blah" is held by SynUnionCase:
SynUnionCase.SynUnionCase(
attributes = [],
ident = SynIdent.SynIdent(ident = Ident("Blah", R("(3,10--3,14)")), trivia = None),
caseType = SynUnionCaseKind.Fields([]),
xmlDoc = PreXmlDoc.Empty,
accessibility = None,
range = R("(3,10--3,14)"),
trivia = { BarRange = None }
but visitSynUnionCase
does not yield anything here because it does not handle the ident
field:
https://github.com/dotnet/fsharp/blob/7e593275025946f062c83fe75c705f196ac532bc/src/Compiler/Driver/GraphChecking/FileContentMapping.fs#L97-L103
So possibly the graph checking misses that dependency?
I tried to run the repro in debug.
It seems we do try to emit FileContentEntry.PrefixedIdentifier
for the exception Blah
but for some reason longId
field here is None
:
https://github.com/dotnet/fsharp/blob/7e593275025946f062c83fe75c705f196ac532bc/src/Compiler/Driver/GraphChecking/FileContentMapping.fs#L64-L70
I might know what the problem is here, will take a look later this week.
A workaround for now could be to express the exceptions are types:
type internal Blah() =
inherit System.Exception()
Enabling GraphBasedChecking can cause compilation to fail.
Repro steps
Create
Repro.fsproj
:Create
Blah.fs
:Create
Program.fs
:Expected behavior
Build succeeds.
Actual behavior
Known workarounds
Disable GraphBasedChecking.
Related information
Provide any related information (optional):