-
Notifications
You must be signed in to change notification settings - Fork 826
Description
I was naively expecting that 'from the end slicing and indexing' would be moved from F#5 Preview to F#6.
But when trying out the following code (taken from F# RFC FS-1076) produces a compiler error when using F# 6.
let list = [1;2;3;4;5]
list.[..^0] // 1,2,3,4,5
list.[..^1] // 1,2,3,4
list.[0..^1] // 1,2,3,4
list.[^1..] // 4,5
list.[^0..] // 5
list.[^2..^1] // 3,4
Compiler error:
"From the end slicing with requires language version 5.0, use /langversion:preview."
I've since learned that this is not yet included in F#6, but it is still in the preview of the language, so I think this should be changed to:
"From the end slicing with requires language version 6.0, use /langversion:preview."
Provide the steps required to reproduce the problem:
Either use your IDE to get error feedback or run dotnet build
to view the errors
If possible attach a zip file with the repro case. This often makes it easier for others to reproduce.
The zip file should ideally represent the situation just before the call/step that is problematic.
Expected behavior
Error should be:
"From the end slicing with requires language version 6.0, use /langversion:preview."
Actual behavior
Compiler error:
From the end slicing with requires language version 5.0, use /langversion:preview.
Known workarounds
You can still set <LangVersion>preview</LangVersion>
but the error is slightly misleading.
Related information
Provide any related information (optional):
-
Operating system
-
.NET Runtime kind (.NET Core, .NET Framework, Mono)
.NET 6 -
Editing Tools (e.g. Visual Studio Version, Visual Studio)
Visual Studio Code