3

I realize that this was asked before but I dare risk being closed as duplicate since the original question is three years old and we are two major F# versions further now.

Update: I have reported this as a bug to the F# team, but I'm still curious if a workaround exists.

Following a classic OO paradigm with F# I tried to inherit shared members through a base class, but immediately got the following error on inlined methods (that, in this particular case, really need to be inlined).

Error FS0073: Internal error: The mustinline value 'SomethingElse' was not inferred to have a known value
Error FS1113: The value 'SomethingElse' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible

A minimized example that throws this error in Visual Studio 2015, using F# 4.0:

type A() =
    static member inline dosomething() = ()

type B() =
    inherit A()
    member inline this.SomethingElse a = a + 10

I am curious. The first error seems to suggest that the type inference fails. However, adding specific type decorations doesn't appear to help.

Error two suggests there's some hidden member that is considered inaccessible. I can't find one. Adding an explicit public member to fool the compiler didn't help either.

My conclusion so far: having any inlined instance member in a class (it doesn't happen on static members) seems to result in compile errors. Perhaps this is similar to not being allowed to inline interface members, which is understandable, but in that case, non-inherited members can still be marked inline.

Any thoughts and/or workarounds that have been found in the past three years?

Community
  • 1
  • 1
Abel
  • 56,041
  • 24
  • 146
  • 247

1 Answers1

0

The correct answer to this question was: it is a bug.

As the report shows, this issue was acknowledged and has meanwhile been fixed and will be part of the next update of F#.

The date on that issue's fix (the merge into the master branch dates Feb 2016) suggests that it either belongs to Update 3 (but I don't see it working there) or the upcoming F# 4.1.

Abel
  • 56,041
  • 24
  • 146
  • 247