Skip to content

Signature file generation chops off leading FSharp. prefix for externally-defined code #12067

Open
@baronfel

Description

@baronfel

Given a member or function that takes a parameter or returns a value of an externally-defined type that begins with FSharp, for example FSharp.Control.AsyncSeq<'t> from the FSharp.Control.AsyncSeq nuget package, generating a signature for that member or function

Repro steps

Provide the steps required to reproduce the problem:

Given this project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <OtherFlags>--allsigs</OtherFlags>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="FSharpPrefix.fs" />
    <PackageReference Include="FSharp.Control.AsyncSeq" Version="3.1.0" />
  </ItemGroup>

</Project>

and this source file:

namespace FSharp.MyStuff

module Library =
    open FSharp.Control

    let batch size (s: AsyncSeq<'t>) =
        AsyncSeq.bufferByCount 12 s

run dotnet build to generate the FSharpPrefix.fsi signature file, which looks like this:

namespace FSharp.MyStuff
  module Library = begin
    val batch : size:'a -> s:Control.AsyncSeq<'t> -> Control.AsyncSeq<'t []>
  end

If this file is added to the project file above the source file, the build fails with the following error:

/Users/chethusk/oss/scratch/FSharpPrefix.fsi(3,38): error FS0039: The type 'AsyncSeq' is not defined in 'Microsoft.FSharp.Control'. Maybe you want one of the following:   Async   AsyncResult   Async`1   AsyncResult`1   AsyncReturn [/Users/chethusk/oss/scratch/scratch.fsproj]

Expected behavior

The signature should be generated with fully-qualified names for types in the FSharp namespace but that are externally-defined

Actual behavior

The leading FSharp is stripped, possibly due to some heuristic?

Known workarounds

Manually edit the signature after generation (which can be rough if --allsigs is enabled in the project file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-SigFileGengeneration of signature files - both compiler and IDEBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions