Skip to content

Signature and implementation files in different folders cannot match in a linked fsproj #6453

Description

@zyzhu

When signature files and source files are not in the same folder while fsproj link them in the same layer, compiler considers signature does not have implementation.

Repro steps

The original problem was in Deedle. paket downloads several source files related to csv parsing directly from FSharp.Data and Deedle adds a few signature files to hide the implementation details.

In the original fsproj that worked then, signatures and source files are in different locations but linked in the same layer in fsproj.

https://github.com/fslaborg/Deedle/blob/b1ff865bfa6a5a69919d621eba11f3c36eb9e9b2/src/Deedle/Deedle.fsproj#L47

But lately when I tried to recompile the library, I had to leave signature files out as it cannot compile. That leads to a bug
fslaborg/Deedle#465

A simplified example is attached
ClassLibrary4.zip

  1. Define .fs, .fsi and .fsproj files

Library.fs

namespace Example

module Hello =
  let hello name = printfn "Hello %s" name

Library.fsi

namespace Example

module Hello =
  val hello : name:string -> unit

ClassLibrary.fsproj

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="signature\Library.fsi" Link="Library.fsi" />
    <Compile Include="src\Library.fs" Link="Library.fs" />
  </ItemGroup>

</Project>
  1. Build project
  2. Error in output
    error FS0240: The signature file 'Library' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match.

Expected behavior

Compiler should recognize that signature file has corresponding implementation file.

Actual behavior

Implementation file is not found.

Known workarounds

Not yet.

Related information

Operating system Win10
netstandard 2.0
VS 2017 Community 15.9.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions