5

I have run into a compile-time error I do not understand while working with F# in Visual Studio 2012.

I could find a minimal snippet here: http://ideone.com/hbhbF

type Foo() =
     inherit System.Exception()
     member inline this.Bar() = ()

Foo().Bar()

What do the following error messages mean?

/home/iU0RLi/prog.fs(3,22): error FS0073: internal error: the mustinline value 'Bar' was not inferred to have a known value

/home/iU0RLi/prog.fs(5,1): error FS1114: The value 'Prog.Foo.Bar' was marked inline but was not bound in the optimization environment

/home/iU0RLi/prog.fs(3,22): error FS1113: The value 'Bar' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible

/home/iU0RLi/prog.fs(5,1): warning FS1116: A value marked as 'inline' has an unexpected value

/home/iU0RLi/prog.fs(5,1): error FS1118: Failed to inline the value 'Bar' marked 'inline', perhaps because a recursive value was marked 'inline'
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
  • 2
    I am leaning towards this being a bug - as it works fine without `inherit System.Exception()`. Have you tried emailing fsbugs@microsoft.com? – John Palmer Sep 16 '12 at 07:39
  • Not yet but I guess the person who posted the short example on ideone some 500 days ago did. I have a similar issues with inlining the 4 navigation functions in XParsec (https://github.com/corsis/XParsec/blob/16de327b98410e3031636ffa86572e12d52f4594/XParsec.fs#L125) though - with no sight of `inherit System.Exception` anywhere. – Cetin Sert Sep 16 '12 at 07:44
  • In that example I am guessing you are probably creating a recursive inline. I would get rid of alot of the inline there as it makes debugging much harder as you lose stack frames. – John Palmer Sep 16 '12 at 08:42
  • Almost all the functions in that module are half up to max. one line long, so there is not much to debug :) – Cetin Sert Sep 16 '12 at 09:08
  • @JohnPalmer simplified `XParsec.Xml` (https://github.com/corsis/XParsec/blob/87d79b12f327673afd211f75e5112d194c51021e/XParsec.fs#L110) by getting rid of recursive `find` but still running into the same error message o_O. – Cetin Sert Sep 16 '12 at 09:40
  • 1
    The sample on github compiles fine for me (if I rename the operators starting with `?` which is not allowed as a first character of operator names). – Tomas Petricek Sep 16 '12 at 13:49
  • @TomasPetricek Wow, lost ... F# 3.0 seems to not bother with `?` but with the added `inline`s to the Xml navigation combinators `next`, `prev`, etc. Perhaps I should try some equivalent of `-Wall` to get the compiler louder about `?` but I assumed the attitude towards `?` was no longer there in 3.0 compared to 2.0. – Cetin Sert Sep 16 '12 at 16:01
  • 1
    @CetinSert That is odd - I get the error with `?` in F# 2.0 (and I supposed it was to avoid clashes with dynamic lookup). Perhaps this is not a problem anymore in F# 3.0. – Tomas Petricek Sep 18 '12 at 17:52

0 Answers0