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

Losing operator call when one of operands is application of a partially applied function #544

Closed
fsoikin opened this issue Mar 23, 2016 · 7 comments

Comments

@fsoikin
Copy link

fsoikin commented Mar 23, 2016

This code:

let f x y = x+y
let g = f 1
let h = (g 2) + 3

Produces TAST without the last (+) call:

    Application
        (Call (null,val g,[],[],[]),[],[Const (2,type Microsoft.FSharp.Core.int)])

If I make g a normal function (i.e. let g x = f 1 x), the problem disappears.

If I make g a value (i.e. let g = 5), the problem disappears.

@dsyme dsyme added the bug label Mar 30, 2016
@dsyme
Copy link
Contributor

dsyme commented Mar 30, 2016

It's possible this is the same bug as #543

@dsyme
Copy link
Contributor

dsyme commented Mar 30, 2016

Fixed by #549

@dsyme dsyme closed this as completed Mar 30, 2016
@dsyme
Copy link
Contributor

dsyme commented Mar 31, 2016

Fix is in 2.0.0.7

@fsoikin
Copy link
Author

fsoikin commented Mar 31, 2016

Awesome, thank you!

@fsoikin
Copy link
Author

fsoikin commented Mar 31, 2016

Hmmm, but now it generates some extraneous lambdas where none are required.

For example:

      let f x = x+5
      let g f y = f y
      let h = g f 42

2.0.0.7 produces:

Call
  (null,val g,[],[type Microsoft.FSharp.Core.int; type Microsoft.FSharp.Core.int],
   [Lambda (val x, Call (null,val f,[],[],[Value val x]));
    Const (42,type Microsoft.FSharp.Core.int)])

But 2.0.0.6 produces:

Call
  (null,val g,[], [type Microsoft.FSharp.Core.int; type Microsoft.FSharp.Core.int],
   [Value val f; Const (42,type Microsoft.FSharp.Core.int)])

This is technically an equivalent program, but not exactly what one would expect.

@dsyme
Copy link
Contributor

dsyme commented Mar 31, 2016

This is by design for first-class uses of all members and module-bound functions. The expansion was always being applied when some arguments were present - it is now applied all the time even when no arguments are given.

@fsoikin
Copy link
Author

fsoikin commented Mar 31, 2016

Ok, thanks.

dsyme added a commit to dsyme/FSharp.Compiler.Service that referenced this issue Apr 13, 2016
VS2015 and VS2013 does not allow change of SolutionDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants