Skip to content

Commit

Permalink
Remove Active Pattern FullName bug example
Browse files Browse the repository at this point in the history
fixed with #1043 (Upgrade to dotnet 7 & new FCS)
(see #1037 (comment) )
  • Loading branch information
Booksbaum committed Feb 17, 2023
1 parent 0c7419d commit c60a552
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions test/FsAutoComplete.Tests.Lsp/FindReferencesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -702,51 +702,6 @@ let tryFixupRangeTests = testList (nameof Tokenizer.tryFixupRange) [
"Should be correct ranges"
}

//TODO: why does this fail? Succeeds when run outside of FSAC
// For example in Script file with `#r "nuget: FSharp.Compiler.Service, 41.0.5"`
// Note: It doesn't use any FSAC stuff -- just FCS
ptestCase "FCS: Active Pattern Case in Declaration" <| fun _ ->
let test () =
let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create()

let text = """
let (|Even|Odd|) v =
if v % 2 = 0 then Even else Odd
match 2 with
| Even -> ()
| Odd -> ()
"""
let file = "code.fsx"
let source = FSharp.Compiler.Text.SourceText.ofString (text)
// decl
let pos = FSharp.Compiler.Text.Position.mkPos 3 24
// usage
// let pos = FSharp.Compiler.Text.Position.mkPos 5 6
let names = ["Even"]

let projOptions, _ =
checker.GetProjectOptionsFromScript (file, source)
|> Async.RunSynchronously
let (parseResults, checkResults') =
checker.ParseAndCheckFileInProject(file, 0, source, projOptions)
|> Async.RunSynchronously
let checkResults =
match checkResults' with
| FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer.Succeeded checkResults -> checkResults
| _ -> failwith "CheckFile -> aborted"

let symbolUse =
checkResults.GetSymbolUseAtLocation(pos.Line, pos.Column, source.GetLineString (pos.Line-1), names)
|> Option.defaultWith (fun _ -> failwith "no symbol at location")

printfn "DisplayNameCore=%A" symbolUse.Symbol.DisplayNameCore
printfn "FullName=%A" symbolUse.Symbol.FullName

if symbolUse.Symbol.DisplayNameCore = "" then
failwith $"No display name for symbol with full name '{symbolUse.Symbol.FullName}'"

test()

testCaseAsync "Active Pattern - simple" <|
check false
"""
Expand Down

0 comments on commit c60a552

Please sign in to comment.