-
Notifications
You must be signed in to change notification settings - Fork 832
Adding parser support for N-d arrays up to rank 32 #13991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
497e502
Adding parser support for N-d arrays up to rank 32
T-Gro c714542
Merge branch 'main' into 12013-type-syntax-for-5d-6d-etc-arrays
T-Gro 99066f8
Formatting tests with Fantomas
T-Gro 62901e7
Merge branch 'main' into 12013-type-syntax-for-5d-6d-etc-arrays
T-Gro d3bd5b1
Merge branch 'main' into 12013-type-syntax-for-5d-6d-etc-arrays
T-Gro 4dc21fd
Merge branch 'main' into 12013-type-syntax-for-5d-6d-etc-arrays
T-Gro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
tests/FSharp.Compiler.ComponentTests/Language/MultiDimensionalArrayTests.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| namespace FSharp.Compiler.ComponentTests.Language | ||
|
|
||
| open Xunit | ||
| open FSharp.Test.Compiler | ||
|
|
||
| module MultiDimensionalArrayTests = | ||
|
|
||
| [<Theory>] | ||
| [<InlineData(1, "array2d")>] | ||
| [<InlineData(5, "array6d")>] | ||
| [<InlineData(31, "array32d")>] | ||
| let ``MultiDimensional array type can be written with or without backticks`` (commas: int, shortcut: string) = | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| let commaString = System.String(',', commas) | ||
|
|
||
| FSharp | ||
| $""" | ||
| module MultiDimArrayTests | ||
| let backTickStyle : int ``[{commaString}]`` = Unchecked.defaultof<_> | ||
| let cleanStyle : int [{commaString}] = backTickStyle | ||
| let shortCutStyle : int {shortcut} = cleanStyle | ||
| """ | ||
| |> compile | ||
| |> shouldSucceed | ||
|
|
||
| [<Fact>] | ||
| let ``Multidimensional array - reports an error if types are not matching`` () = | ||
| let commaString = System.String(',', 30) | ||
|
|
||
| FSharp | ||
| $""" | ||
| module MultiDimArrayErrorTests | ||
| let cleanStyle : int [{commaString}] = Unchecked.defaultof<_> | ||
| let shortCutStyle : int array32d = cleanStyle | ||
| """ | ||
| |> compile | ||
| |> shouldFail | ||
| |> withSingleDiagnostic (Error 1, Line 4, Col 36, Line 4, Col 46, "This expression was expected to have type | ||
| 'int array32d' | ||
| but here has type | ||
| 'int array31d' ") | ||
|
|
||
| [<Fact>] | ||
| let ``Multidimensional with rank over 32 cannot be defined`` () = | ||
| let commaString = System.String(',', 42) | ||
|
|
||
| FSharp | ||
| $""" | ||
| module MultiDimArrayErrorTests | ||
| let cleanStyle : int [{commaString}] = Unchecked.defaultof<_> | ||
| """ | ||
| |> compile | ||
| |> shouldFail | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.