Skip to content
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

Bad split of chained method call expression #246

Closed
SteveGilham opened this issue May 7, 2018 · 2 comments · Fixed by #314
Closed

Bad split of chained method call expression #246

SteveGilham opened this issue May 7, 2018 · 2 comments · Fixed by #314

Comments

@SteveGilham
Copy link

SteveGilham commented May 7, 2018

Before

                             root.SetAttribute("driverVersion", "AltCover.Recorder " +
                                     System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion)

After

            root.SetAttribute
                ("driverVersion", 
                 "AltCover.Recorder " 
                 + System.Diagnostics.FileVersionInfo.GetVersionInfo
                       (System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion) //  line 127

The first builds, the second goes
Base.fs(127,85):error FS0039: The field, constructor or member 'FileVersion' is not defined.
Base.fs(126,20): error FS0001: The type 'Diagnostics.FileVersionInfo' does not match the type 'string'

@SteveGilham SteveGilham changed the title Bad split of long expression Bad split of chained call expression May 7, 2018
@SteveGilham SteveGilham changed the title Bad split of chained call expression Bad split of chained method call expression May 7, 2018
@danyx23
Copy link
Contributor

danyx23 commented May 13, 2018

Another case of what might be the same problem:

Before:

type Exception with
        member inline __.FirstLine = 
            __.Message.Split([|Environment.NewLine|], StringSplitOptions.RemoveEmptyEntries).[0]

After:

type Exception with
        member inline __.FirstLine =
            __.Message.Split
                ([| Environment.NewLine |],
                 StringSplitOptions.RemoveEmptyEntries).[0]

Results in compile error:
The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints

@SteveGilham
Copy link
Author

This issue is back in version 4.0.0, in the self-same piece of code

https://fsprojects.github.io/fantomas-tools/#/fantomas/preview?data=N4KABGBEDGD2AmBTSAuKEMYE61gFwDoBlRPAQTzywEsAjAVz0QB0tmA7TLsACmcng0AboiwA1UQGdqsd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dEYJjwLt%2B1Vn9A0uTRbkxRdE0sYG1K4dDzWpo4ZpYKyLgI7yB3Ixgg26WAtFQPRTwg1jMlJRx0NiP60b9PA%2Bzk9Bh3abT9N4udzNeZN4MYNScnQ2ErXVLU3Omnz1B7RTSNC8Nk7nZJEvYzYGrmaCDL0JokRstGhrQAA1tGqa26QkiZUQaa8Qa9CuAJgaOVrp06xjes1ZLgYan5oIAHKIK2nXWrGeDtpyWXSu1ST9IVtRkKaREjFIxXrX7gMVYHcWSldU1cBqKWggA0ogiB3Ity2cokrvplaNo2L7x1Df7dGjeLwcG5qDUm8ya16pI3L85Thdo0DhmlvrrPcBqs2gtCAxRM1vie%2BleWILQDIIJ3Kjd-9ZVF2dJfVWXYOh7doIaNQ-jy%2BwiuyNC-jzPQCZZbAaVIR9lkPnciKMAbz2LtOW%2Bbpy5SwgBqKGT9NCiHYH2EQMwBg51oKIVO6dTyHEEgXHuwt0bQKXkPFelc8YbyoMEPAx8kCgP6tTTE2xUQImeJIMI0gji%2BwxEAA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants