Skip to content

Bug, F# 4.0 inlining inside derived class *always* throwing FS0073 internal error: the mustinline value 'Foo' was not inferred to have a known value #740

Closed

Description

@abelbraaksma

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

Activity

  1. changed the title [-]Bug, F# 4.0 with class inheritance throwing internal error: the mustinline value 'Foo' was not inferred to have a known value[/-] [+]Bug, F# 4.0 with class inheritance throwing FS0073 internal error: the mustinline value 'Foo' was not inferred to have a known value[/+] on Nov 26, 2015
  2. changed the title [-]Bug, F# 4.0 with class inheritance throwing FS0073 internal error: the mustinline value 'Foo' was not inferred to have a known value[/-] [+]Bug, F# 4.0 inlining inside derived class *always* throwing FS0073 internal error: the mustinline value 'Foo' was not inferred to have a known value[/+] on Nov 26, 2015
  3. abelbraaksma commented on Dec 4, 2015

    @abelbraaksma
    ContributorAuthor

    @KevinRansom out of curiosity, why removing the priority? From what it looks like, this is a (moderately) serious bug in the sense that a feature that is supposed to work, won't compile at all.... (but perhaps I just don't know well enough how the prioritization works around here).

  4. dsyme commented on Dec 4, 2015

    @dsyme
    Contributor

    It looks like all the priority labels have been removed - they were just adhoc labels I was adding based on my own estimates. I presume Kevin and others will re-add some kind of prioritization labels as part of the work for #752.

  5. dsyme commented on Dec 4, 2015

    @dsyme
    Contributor

    I've pushed a fix here: #740

  6. added
    Impact-Medium
    on Jan 8, 2016
  7. dsyme commented on Jul 18, 2016

    @dsyme
    Contributor

    Fixed

  8. abelbraaksma commented on Dec 19, 2016

    @abelbraaksma
    ContributorAuthor

    @dsyme, the date on this fix suggests it was fixed back in December 2015, which makes me think it was part of the most recent Update 3 of Visual Studio and the F# fixes that went along.

    However, just trying out the example from the original bug report still shows the same errors. Does this mean it isn't fixed, or does this mean it is fixed but will be available in some later release? Could I find this (what release the fix will be published in) out somehow without bothering you about it?

  9. abelbraaksma commented on Oct 4, 2017

    @abelbraaksma
    ContributorAuthor

    Tested this today again with the VS2017 Enterprise RTM release. It works, no need to reopen. Tx!

  10. dsyme commented on Oct 4, 2017

    @dsyme
    Contributor

    @abelbraaksma Thank you so much!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-Medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions