@@ -3026,6 +3026,8 @@ type AnotherMutableList() =
30263026let f1 (x: System.Collections.Generic.IList<'T>) = () // grab the IList symbol and look into it
30273027let f2 (x: AnotherMutableList) = () // grab the AnotherMutableList symbol and look into it
30283028let f3 (x: System.Collections.ObjectModel.ObservableCollection<'T>) = () // grab the ObservableCollection symbol and look into it
3029+ let f4 (x: int[]) = () // test a one-dimensional array
3030+ let f5 (x: int[,,]) = () // test a multi-dimensional array
30293031 """
30303032 File.WriteAllText( fileName1, fileSource1)
30313033 let cleanFileName a = if a = fileName1 then " file1" else " ??"
@@ -3048,21 +3050,33 @@ let ``Test Project22 IList contents`` () =
30483050
30493051 let wholeProjectResults = checker.ParseAndCheckProject( Project22.options) |> Async.RunSynchronously
30503052
3051- let ilistTypeUse =
3053+ let allUsesOfAllSymbols =
30523054 wholeProjectResults.GetAllUsesOfAllSymbols()
30533055 |> Async.RunSynchronously
3056+
3057+ let ilistTypeUse =
3058+ allUsesOfAllSymbols
30543059 |> Array.find ( fun su -> su.Symbol.DisplayName = " IList" )
30553060
30563061 let ocTypeUse =
3057- wholeProjectResults.GetAllUsesOfAllSymbols()
3058- |> Async.RunSynchronously
3062+ allUsesOfAllSymbols
30593063 |> Array.find ( fun su -> su.Symbol.DisplayName = " ObservableCollection" )
30603064
30613065 let alistTypeUse =
3062- wholeProjectResults.GetAllUsesOfAllSymbols()
3063- |> Async.RunSynchronously
3066+ allUsesOfAllSymbols
30643067 |> Array.find ( fun su -> su.Symbol.DisplayName = " AnotherMutableList" )
30653068
3069+ let allTypes =
3070+ allUsesOfAllSymbols
3071+ |> Array.choose ( fun su -> match su.Symbol with :? FSharpMemberOrFunctionOrValue as s -> Some s.FullType | _ -> None )
3072+
3073+ let arrayTypes =
3074+ allTypes
3075+ |> Array.choose ( fun t ->
3076+ if t.HasTypeDefinition then
3077+ let td = t.TypeDefinition
3078+ if td.IsArrayType then Some ( td.DisplayName, td.ArrayRank) else None
3079+ else None )
30663080
30673081 let ilistTypeDefn = ilistTypeUse.Symbol :?> FSharpEntity
30683082 let ocTypeDefn = ocTypeUse.Symbol :?> FSharpEntity
@@ -3111,6 +3125,8 @@ let ``Test Project22 IList contents`` () =
31113125 ( set [( " IList" , [ " interface" ]); ( " ICollection" , [ " interface" ]);
31123126 ( " IEnumerable" , [ " interface" ]); ( " IEnumerable" , [ " interface" ])])
31133127
3128+ arrayTypes |> shouldEqual [|( " []" , 1 ); ( " [,,]" , 3 )|]
3129+
31143130[<Test>]
31153131let ``Test Project22 IList properties`` () =
31163132
0 commit comments