Skip to content

Unfixable FS0076 error from fsharpi when putting #r directive in .fs file #569

@kg

Description

@kg

It appears to be impossible to actually put a #r directive in a .fs file, at least as far as fsharpi on linux is concerned. Test case:

#if INTERACTIVE
#r "FParsec.dll"
#endif

module Test

let test =
  5

If I load this file with fsharpi It generates a FS0076:
~/Desktop/test.fs(2,1): error FS0076: #r directives may only occur in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-r' compiler option for this reference or delimit the directive with '#if INTERACTIVE'/'#endif'.

Except as you can see, I followed those directions and it didn't fix it. I can't find any information about this on the web so this appears to be some sort of a bug in fsharpi. I've tried every permutation of this that I can think of and it just doesn't work. If you remove the #r directive, fsharpi happily loads and compiles the file.

The FS0076 guidance should be modified to remove the #if INTERACTIVE workaround if it's not intended to work. (I assume it's intended to work, though?)

Configuration details:
fsharpi --help prints F# Interactive for F# 3.0 (Open Source Edition).
Installed mono and fsharp from the mono-project package sources using the official directions (sudo apt-get install mono-complete fsharp).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions