-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Problems with very long lines and/or files #119
Comments
As I understand the crux of the problem lies in the way of storing positions used by F# compiler. If you peek into https://github.com/fsharp/fsharp/blob/master/src/fsharp/range.fs#L32 you'll see that position stores everything in one int32 value and reserves 9 bits to store column - this explains why values >= 2 ^10 will overflow |
As I understand this was done to reduce memory pressure because of HUGE amount of 'pos' instances in-flight. You can alter existing implementation of 'pos' though |
Thanks. I see it now. I'll try to increase bit count of columns to see memory pressure. Another question: Why do I have to patch a range when it has multiple lines and consists of |
There will be a reason, but not a good one :) Would be good to remove the source of that problem. |
@nojaf @jindraivanek This may be able to be closed. F# 4.6 (and corresponding FCS) now use larger ranges. Range isn't notable in memory pressure in recent measurements of the F# tools (though boxing due to comparison was until that was recently fixed...) |
Ranges in newer versions of the FCS have indeed improved, I don't think this is a problem anymore. |
We use ranges from F# ASTs in order to look up constants (numbers, strings, etc.). It is handled by https://github.com/dungpa/fantomas/blob/master/src/Fantomas/SourceParser.fs#L24. However, constant lookups are unreliable. Range values produced by F# ASTs are really strange:
This code fragment
always have columns smaller than 512 although it has more than 1000 characters. At some point, there are a range like "line 2 - column 500, line 2 - column 22" as if columns have been wrapped around at 512.
This is the root of bugs #83, #85 and #110.
My questions:
cc @dsyme @ovatsus
The text was updated successfully, but these errors were encountered: