dotnet / dotnet/fsharp

fsi incorrect handling of some script arguments

Open
#19,214 0 comments 0 reactions 0 assignees View on GitHub
Area-FSI Bug
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

Consider script test_args.fsx:
```
printfn "%A" fsi.CommandLineArgs
```

When execing:
```
>dotnet fsi test_args.fsx -r -f
[|"test_args.fsx"; "-r:-f"|]
```
When using:
```
>dotnet fsi --use:test_args.fsx -- -- -r -f

Microsoft (R) F# Interactive version 14.0.101.0 for F# 10.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> [|"test_args.fsx"; "-r:-f"|]
val it: unit = ()
```

From looking over `fsi.fs`, it seems that `PostProcessCompilerArgs` is called before any other command line processing. This will find the '-r' and treat it as an abbreviated `--reference` option, combining it with its "argument" into a single `-r:-f`. Perhaps, rather than the initial `PostProcessCompilerArgs`, the check for a space-separated arg for `-r` (for example) could be added to the main loop in `ParseCompilerOptions`.

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.