dotnet / dotnet/fsharp

Some warnings may be discarded using #load with forward slash path separators

Open
#1,240 0 comments 0 reactions 0 assignees View on GitHub
AI-thinks-windows-only Area-FSI Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

I noticed this issue while reproducing #1126: using forward slashes in the path for `#load "c:/temp/nada.fsx"` suppressed the warning in FSI when it seems it shouldn't have.

https://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/CompileOps.fs#L5001
The file path comparison doesn't "normalize" the path separators, so `rootFilename` still has forward slashes while `m.FileName` doesn't, and warnings later get filtered by `isRootRange`.
#### Repro steps

To reproduce, create a file, say `C:\temp\nada.fsx` containing

```
#nowarn "211"
#I "totally-non-existing-folder"
```

And then run the following in F# Interactive:

```
> #load "C:/temp/nada.fsx";;
```
#### Expected behavior

```
> #load "C:/temp/nada.fsx";;

[Loading C:\temp\nada.fsx]
C:\temp\nada.fsx(2,1): warning FS0211: The search directory
'C:\temp\totally-non-existing-folder' could not be found
namespace FSI_0002
```

I think the warning should've (erroneously, according to #1126 and #1239) appeared whether using backward or forward slashes with `#load`.
#### Actual behavior

```
> #load "C:/temp/nada.fsx";;

[Loading C:\temp\nada.fsx]

namespace FSI_0002
```

Warning doesn't appear as it does when using backslashes in path.
#### Known workarounds

Don't use forward slashes in `#load` paths.
#### Related information

The repro steps for this issue will no longer work if #1239 is merged, but I think the issue will still exist.
- Windows 10.0.10586
- master branch
- .NET 4
- Low severity?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.