Skip to content

Commit 7569771

Browse files
authored
Merge pull request #50 from dawedawe/option_name_exn
deal with options and properties that might throw
2 parents 786a965 + 8f6c633 commit 7569771

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixed
66
* Handle types without a FullName more gracefully in the EmptyStringAnalyzer. [#48](https://github.com/ionide/ionide-analyzers/pull/48)
7+
* Handle types without a FullName more gracefully in the HandleOptionGracefullyAnalyzer. [#50](https://github.com/ionide/ionide-analyzers/pull/50)
78

89
## 0.5.0 - 2023-11-23
910

src/Ionide.Analyzers/Suggestion/HandleOptionGracefullyAnalyzer.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ let optionGetAnalyzer (ctx: CliContext) =
1717
{ new TypedTreeCollectorBase() with
1818
override x.WalkCall _ (mfv: FSharpMemberOrFunctionOrValue) _ _ (args: FSharpExpr list) (m: range) =
1919
let fullyQualifiedCall =
20-
String.Join(".", mfv.DeclaringEntity.Value.FullName, mfv.DisplayName)
20+
let fullName =
21+
mfv.DeclaringEntity
22+
|> Option.map (fun e -> e.TryFullName)
23+
|> Option.flatten
24+
|> Option.defaultValue ""
25+
26+
String.Join(".", fullName, mfv.DisplayName)
2127

2228
if
2329
(mfv.FullName = "Microsoft.FSharp.Core.Option.get"

0 commit comments

Comments
 (0)