Skip to content

GraphBasedChecking can break compilation when having unused open #16225

@BoundedChenn31

Description

@BoundedChenn31

Not sure if it's a real problem though.

Repro steps
Project file:

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

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net7.0</TargetFramework>
        <OtherFlags>$(OtherFlags) --test:GraphBasedChecking</OtherFlags>
    </PropertyGroup>

    <ItemGroup>
        <Compile Include="File1.fs" />
        <Compile Include="File2.fs" />
        <Compile Include="Program.fs"/>
    </ItemGroup>

</Project>

File1:

namespace My.Great.Namespace

File2:

namespace My.Great.Namespace

open My.Great.Namespace

type Foo = class end

Program:

printfn "Hello"

Compilation fails with error
1>File2.fs(3,6): Error FS0039 : The namespace or module 'My' is not defined.

But with commented out <OtherFlags> line compilation is successful.
NamespaceIsNotDefRepro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions