Skip to content

Commit 4c4c389

Browse files
dotnet-botedgarfgpvzarytovskii
authored
Merge main to release/dev17.4 (#13980)
Co-authored-by: Edgar Gonzalez <[email protected]> Co-authored-by: Vlad Zarytovskii <[email protected]>
1 parent d8e171d commit 4c4c389

File tree

4 files changed

+11
-43
lines changed

4 files changed

+11
-43
lines changed

src/Compiler/Checking/NicePrint.fs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -875,16 +875,6 @@ module PrintTypes =
875875
| [] -> tcL
876876
| [arg] -> layoutTypeWithInfoAndPrec denv env 2 arg ^^ tcL
877877
| args -> bracketIfL (prec <= 1) (bracketL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) args) --- tcL)
878-
879-
and layoutTypeForGenericMultidimensionalArrays denv env prec tcref innerT level =
880-
let innerLayout = layoutTypeWithInfoAndPrec denv env prec innerT
881-
882-
let arrayLayout =
883-
tagEntityRefName denv tcref $"array{level}d"
884-
|> mkNav tcref.DefinitionRange
885-
|> wordL
886-
887-
innerLayout ^^ arrayLayout
888878

889879
/// Layout a type, taking precedence into account to insert brackets where needed
890880
and layoutTypeWithInfoAndPrec denv env prec ty =
@@ -906,10 +896,6 @@ module PrintTypes =
906896
// Always prefer 'float' to 'float<1>'
907897
| TType_app (tc, args, _) when tc.IsMeasureableReprTycon && List.forall (isDimensionless g) args ->
908898
layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided g tc args)
909-
910-
// Special case for nested array<array<'t>> shape
911-
| TTypeMultiDimensionalArrayAsGeneric (tcref, innerT, level) ->
912-
layoutTypeForGenericMultidimensionalArrays denv env prec tcref innerT level
913899

914900
// Layout a type application
915901
| TType_ucase (UnionCaseRef(tc, _), args)

src/Compiler/TypedTree/TypedTreeOps.fs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10410,18 +10410,4 @@ let (|EmptyModuleOrNamespaces|_|) (moduleOrNamespaceContents: ModuleOrNamespaceC
1041010410
Some emptyModuleOrNamespaces
1041110411
else
1041210412
None
10413-
| _ -> None
10414-
10415-
let (|TTypeMultiDimensionalArrayAsGeneric|_|) (t: TType) =
10416-
let rec (|Impl|_|) t =
10417-
match t with
10418-
| TType_app(tc, [Impl(outerTc, innerT, currentLevel)], _) when tc.DisplayNameCore = "array" ->
10419-
Some (outerTc, innerT, currentLevel + 1)
10420-
| TType_app(tc, [arg], _) when tc.DisplayNameCore = "array" ->
10421-
Some (tc, arg, 1)
10422-
| _ -> None
10423-
10424-
match t with
10425-
| Impl (tc, arg, level) ->
10426-
if level > 2 then Some (tc, arg, level) else None
10427-
| _ -> None
10413+
| _ -> None

src/Compiler/TypedTree/TypedTreeOps.fsi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,6 +2687,3 @@ type TraitConstraintInfo with
26872687
/// This will match anything that does not have any types or bindings.
26882688
val (|EmptyModuleOrNamespaces|_|):
26892689
moduleOrNamespaceContents: ModuleOrNamespaceContents -> (ModuleOrNamespace list) option
2690-
2691-
/// Captures an application type with a multi-dimensional array as postfix.
2692-
val (|TTypeMultiDimensionalArrayAsGeneric|_|): t: TType -> (TyconRef * TType * int) option

tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ let ``4 dimensional array`` () =
3232
"val a: int array4d"
3333

3434
[<Fact>]
35-
let ``5 till 32 dimensional array`` () =
36-
[ 5 .. 32 ]
37-
|> List.iter (fun idx ->
38-
let arrayType =
39-
[ 1 .. idx ]
40-
|> List.fold (fun acc _ -> $"array<{acc}>") "int"
41-
42-
assertSingleSignatureBinding
43-
$"let a : {arrayType} = failwith \"todo\""
44-
$"val a: int array{idx}d"
45-
)
35+
let ``jagged array 1`` () =
36+
assertSingleSignatureBinding
37+
"let a : array<array<array<array<array<int>>>>> = failwith \"todo\""
38+
"val a: int array array array array array"
39+
40+
[<Fact>]
41+
let ``jagged array 2`` () =
42+
assertSingleSignatureBinding
43+
"let a: int[][][][][] = failwith \"todo\""
44+
"val a: int array array array array array"
4645

4746
[<Fact>]
4847
let ``Use array2d syntax in implementation`` () =

0 commit comments

Comments
 (0)