FS0193: internal error: startIndex cannot be larger than length of string. (Parameter 'startIndex') #18402
Labels
Area-Compiler-Syntax
lexfilter, indentation and parsing
Bug
Impact-Low
(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
I have noticed some very strange behaviour related to line directives, which in some cases lead to compiler errors.
Repro steps
This exact piece of code shows the behaviour:
Expected behavior
The code should compile fine and print
ab
when executed.Actual behavior
Also, very strangely, if I remove
FSharp.Core.ExtraTopLevelOperators.
, I get another strange error:And, if I instead replace it with
do
, I get:I don't think the particular sequences I replace it with matter, it seems to be more a line position thing.
Known workarounds
I did not manage to find a workaround that preserves the line information. I would certainly appreciate a solution that works for older compilers.
Related information
Tested on .NET SDK 9.0.201.
Examples:
The text was updated successfully, but these errors were encountered: