-
Notifications
You must be signed in to change notification settings - Fork 842
Description
Combining inheritance and inlining instance members on the derived class throws an internal error and a (somewhat, but erroneous) normal error:
FS0073: Internal error: The mustinline value 'SomethingElse' was not inferred to have a known value
FS1113: The value 'SomethingElse' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible
This behavior can be seen by using the following trivial example (it doesn't matter whether the base class has types or not):
type A() =
static member inline dosomething() = ()
type B() =
inherit A()
member inline this.SomethingElse a = a + 10
The first error suggests that the type inference fails. Yet, adding a specific type decoration to the member doesn't make the error go away.
The second error suggests that the implementation is using something that cannot be accessed. This seems to be just plain wrong, as the implementation of SomethingElse has no dependencies. Adding explicit public methods to the base class does not help to fool the compiler.
In short, at present, it is not possible to combine instance member inlining with base classes.
I have not managed (yet) to find a workaround, though I'd be interested if one exists. I have reported this previously at StackOverflow
Note (1): this behavior has been observed in F# 2.0 and 3.0 as well, but I couldn't find out whether it was reported here before.
Note (2): if you run this example from the command prompt, it repeats each error twice, on the exact same line and position:
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
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