@@ -3024,6 +3024,8 @@ type AnotherMutableList() =
30243024let f1 (x: System.Collections.Generic.IList<'T>) = () // grab the IList symbol and look into it
30253025let f2 (x: AnotherMutableList) = () // grab the AnotherMutableList symbol and look into it
30263026let f3 (x: System.Collections.ObjectModel.ObservableCollection<'T>) = () // grab the ObservableCollection symbol and look into it
3027+ let f4 (x: int[]) = () // test a one-dimensional array
3028+ let f5 (x: int[,,]) = () // test a multi-dimensional array
30273029 """
30283030 File.WriteAllText( fileName1, fileSource1)
30293031 let cleanFileName a = if a = fileName1 then " file1" else " ??"
@@ -3046,21 +3048,33 @@ let ``Test Project22 IList contents`` () =
30463048
30473049 let wholeProjectResults = checker.ParseAndCheckProject( Project22.options) |> Async.RunSynchronously
30483050
3049- let ilistTypeUse =
3051+ let allUsesOfAllSymbols =
30503052 wholeProjectResults.GetAllUsesOfAllSymbols()
30513053 |> Async.RunSynchronously
3054+
3055+ let ilistTypeUse =
3056+ allUsesOfAllSymbols
30523057 |> Array.find ( fun su -> su.Symbol.DisplayName = " IList" )
30533058
30543059 let ocTypeUse =
3055- wholeProjectResults.GetAllUsesOfAllSymbols()
3056- |> Async.RunSynchronously
3060+ allUsesOfAllSymbols
30573061 |> Array.find ( fun su -> su.Symbol.DisplayName = " ObservableCollection" )
30583062
30593063 let alistTypeUse =
3060- wholeProjectResults.GetAllUsesOfAllSymbols()
3061- |> Async.RunSynchronously
3064+ allUsesOfAllSymbols
30623065 |> Array.find ( fun su -> su.Symbol.DisplayName = " AnotherMutableList" )
30633066
3067+ let allTypes =
3068+ allUsesOfAllSymbols
3069+ |> Array.choose ( fun su -> match su.Symbol with :? FSharpMemberOrFunctionOrValue as s -> Some s.FullType | _ -> None )
3070+
3071+ let arrayTypes =
3072+ allTypes
3073+ |> Array.choose ( fun t ->
3074+ if t.HasTypeDefinition then
3075+ let td = t.TypeDefinition
3076+ if td.IsArrayType then Some ( td.DisplayName, td.ArrayRank) else None
3077+ else None )
30643078
30653079 let ilistTypeDefn = ilistTypeUse.Symbol :?> FSharpEntity
30663080 let ocTypeDefn = ocTypeUse.Symbol :?> FSharpEntity
@@ -3109,6 +3123,8 @@ let ``Test Project22 IList contents`` () =
31093123 ( set [( " IList" , [ " interface" ]); ( " ICollection" , [ " interface" ]);
31103124 ( " IEnumerable" , [ " interface" ]); ( " IEnumerable" , [ " interface" ])])
31113125
3126+ arrayTypes |> shouldEqual [|( " []" , 1 ); ( " [,,]" , 3 )|]
3127+
31123128[<Test>]
31133129let ``Test Project22 IList properties`` () =
31143130
0 commit comments