@@ -613,7 +613,103 @@ let test3 = System.Text.RegularExpressions.RegexOptions.Compiled
613613]
614614|]
615615
616+ [<Test>]
617+ let ``IL enum fields should be reported`` () =
618+ let input =
619+ """
620+ open System
621+
622+ let _ =
623+ match ConsoleKey.Tab with
624+ | ConsoleKey.OemClear -> ConsoleKey.A
625+ | _ -> ConsoleKey.B
626+ """
627+
628+ let file = " /home/user/Test.fsx"
629+ let _ , typeCheckResults = parseAndCheckScript( file, input)
630+ typeCheckResults.GetAllUsesOfAllSymbolsInFile()
631+ |> Async.RunSynchronously
632+ |> Array.map( fun su ->
633+ let r = su.RangeAlternate
634+ su.Symbol.ToString(), ( r.StartLine, r.StartColumn, r.EndLine, r.EndColumn))
635+ |> shouldEqual
636+ [|( " ConsoleKey" , ( 5 , 10 , 5 , 20 ))
637+ ( " field Tab" , ( 5 , 10 , 5 , 24 ))
638+ ( " ConsoleKey" , ( 6 , 6 , 6 , 16 ))
639+ ( " field OemClear" , ( 6 , 6 , 6 , 25 ))
640+ ( " ConsoleKey" , ( 6 , 29 , 6 , 39 ))
641+ ( " field A" , ( 6 , 29 , 6 , 41 ))
642+ ( " ConsoleKey" , ( 7 , 11 , 7 , 21 ))
643+ ( " field B" , ( 7 , 11 , 7 , 23 ))
644+ ( " Test" , ( 1 , 0 , 1 , 0 ))|]
616645
646+ [<Test>]
647+ let ``Literal values should be reported`` () =
648+ let input =
649+ """
650+ module Module1 =
651+ let [<Literal>] ModuleValue = 1
652+
653+ let _ =
654+ match ModuleValue + 1 with
655+ | ModuleValue -> ModuleValue + 2
656+ | _ -> 0
657+
658+ type Class1() =
659+ let [<Literal>] ClassValue = 1
660+ static let [<Literal>] StaticClassValue = 2
661+
662+ let _ = ClassValue
663+ let _ = StaticClassValue
664+
665+ let _ =
666+ match ClassValue + StaticClassValue with
667+ | ClassValue -> ClassValue + 1
668+ | StaticClassValue -> StaticClassValue + 2
669+ | _ -> 3
670+ """
671+
672+ let file = " /home/user/Test.fsx"
673+ let _ , typeCheckResults = parseAndCheckScript( file, input)
674+ typeCheckResults.GetAllUsesOfAllSymbolsInFile()
675+ |> Async.RunSynchronously
676+ |> Array.map( fun su ->
677+ let r = su.RangeAlternate
678+ su.Symbol.ToString(), ( r.StartLine, r.StartColumn, r.EndLine, r.EndColumn))
679+ |> shouldEqual
680+ [|( " LiteralAttribute" , ( 3 , 10 , 3 , 17 ))
681+ ( " LiteralAttribute" , ( 3 , 10 , 3 , 17 ))
682+ ( " member .ctor" , ( 3 , 10 , 3 , 17 ))
683+ ( " val ModuleValue" , ( 3 , 20 , 3 , 31 ))
684+ ( " val op_Addition" , ( 6 , 26 , 6 , 27 ))
685+ ( " val ModuleValue" , ( 6 , 14 , 6 , 25 ))
686+ ( " val ModuleValue" , ( 7 , 10 , 7 , 21 ))
687+ ( " val op_Addition" , ( 7 , 37 , 7 , 38 ))
688+ ( " val ModuleValue" , ( 7 , 25 , 7 , 36 ))
689+ ( " Module1" , ( 2 , 7 , 2 , 14 ))
690+ ( " Class1" , ( 10 , 5 , 10 , 11 ))
691+ ( " member .ctor" , ( 10 , 5 , 10 , 11 ))
692+ ( " LiteralAttribute" , ( 11 , 10 , 11 , 17 ))
693+ ( " LiteralAttribute" , ( 11 , 10 , 11 , 17 ))
694+ ( " member .ctor" , ( 11 , 10 , 11 , 17 ))
695+ ( " val ClassValue" , ( 11 , 20 , 11 , 30 ))
696+ ( " LiteralAttribute" , ( 12 , 17 , 12 , 24 ))
697+ ( " LiteralAttribute" , ( 12 , 17 , 12 , 24 ))
698+ ( " member .ctor" , ( 12 , 17 , 12 , 24 ))
699+ ( " val StaticClassValue" , ( 12 , 27 , 12 , 43 ))
700+ ( " val ClassValue" , ( 14 , 12 , 14 , 22 ))
701+ ( " val StaticClassValue" , ( 15 , 12 , 15 , 28 ))
702+ ( " val op_Addition" , ( 18 , 25 , 18 , 26 ))
703+ ( " val ClassValue" , ( 18 , 14 , 18 , 24 ))
704+ ( " val StaticClassValue" , ( 18 , 27 , 18 , 43 ))
705+ ( " val ClassValue" , ( 19 , 10 , 19 , 20 ))
706+ ( " val op_Addition" , ( 19 , 35 , 19 , 36 ))
707+ ( " val ClassValue" , ( 19 , 24 , 19 , 34 ))
708+ ( " val StaticClassValue" , ( 20 , 10 , 20 , 26 ))
709+ ( " val op_Addition" , ( 20 , 47 , 20 , 48 ))
710+ ( " val StaticClassValue" , ( 20 , 30 , 20 , 46 ))
711+ ( " member .cctor" , ( 10 , 5 , 10 , 11 ))
712+ ( " Test" , ( 1 , 0 , 1 , 0 ))|]
617713
618714//-------------------------------------------------------------------------------
619715