Skip to content

Problems using FSI on a project #44

Description

@KevinRansom

Opened at CodePlex by ovatsus
[from https://github.com/fsharp/fsharp/issues/278](from fsharp/fsharp#278)

Let's say we have an F# project consistent of two files (this is the minimum to be able reproduce this):

File A.fs:

namespace Project

type DU = A | B

File B.fs:

namespace Project

type B = { Prop : DU }

This compiles fine. If you now want to test this on a script file:

#load "A.fs"
#load "B.fs"

If you evaluate this, you'l get this error:

[Loading c:\users\guguer\documents\visual studio 2013\Projects\ConsoleApplication2\A.fs]

namespace FSI_0002.Project
  type DU =
    | A
    | B

> 
[Loading c:\users\guguer\documents\visual studio 2013\Projects\ConsoleApplication2\B.fs]


B.fs(3,19): error FS0039: The type 'DU' is not defined
> 

There is a workaround, which is to include open Project on B.fs, but it's not obvious. On big projects, and for new users, this is a stumbling block that makes things look broken.

Similar issues happen with modules instead of namespaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions