Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Symbols/SymbolHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module internal SymbolHelpers =
| Item.Value vref | Item.CustomBuilder (_, vref) -> Some (rangeOfValRef preferFlag vref)
| Item.UnionCase(ucinfo, _) -> Some (rangeOfUnionCaseInfo preferFlag ucinfo)
| Item.ActivePatternCase apref -> Some (rangeOfValRef preferFlag apref.ActivePatternVal)
| Item.ExnCase tcref -> Some tcref.Range
| Item.ExnCase tcref -> Some (rangeOfEntityRef preferFlag tcref)
| Item.AnonRecdField (_,_,_,m) -> Some m
| Item.RecdField rfinfo -> Some (rangeOfRecdFieldInfo preferFlag rfinfo)
| Item.UnionCaseField (UnionCaseInfo (_, ucref), fieldIndex) -> Some (rangeOfRecdField preferFlag (ucref.FieldByIndex(fieldIndex)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,22 @@ val myFunc2: param: int -> int
}

module Exceptions =
let project() = SyntheticProject.Create(
{ sourceFile "First" [] with ExtraSource = "exception MyException of string" },
{ sourceFile "Second" [] with ExtraSource = """
let source1 = "exception MyException of string"
let signature1 = "exception MyException of string"

let source2 = """
open ModuleFirst
let foo x = raise (MyException "foo")""" })
let foo x = raise (MyException "foo")
"""
let project() = SyntheticProject.Create(
{ sourceFile "First" [] with ExtraSource = source1 },
{ sourceFile "Second" [] with ExtraSource = source2 })

let projectWithSignature() = SyntheticProject.Create(
{ sourceFile "First" [] with
ExtraSource = source1
SignatureFile = Custom signature1 },
{ sourceFile "Second" [] with ExtraSource = source2 })

[<Fact>]
let ``We find exception from definition`` () =
Expand All @@ -292,6 +303,28 @@ let foo x = raise (MyException "foo")""" })
])
}

[<Fact>]
let ``We find exception from definition and signature`` () =
projectWithSignature().Workflow {
placeCursor "First" 6 21 "exception MyException of string" ["MyException"]
findAllReferences (expectToFind [
"FileFirst.fs", 6, 10, 21
"FileFirst.fsi", 2, 10, 21
"FileSecond.fs", 8, 19, 30
])
}

[<Fact>]
let ``We find exception from usage and signature`` () =
projectWithSignature().Workflow {
placeCursor "Second" 8 30 "raise (MyException \"foo\")" ["MyException"]
findAllReferences (expectToFind [
"FileFirst.fs", 6, 10, 21
"FileFirst.fsi", 2, 10, 21
"FileSecond.fs", 8, 19, 30
])
}

module Attributes =

let project() = SyntheticProject.Create(
Expand Down
Loading