diff --git a/src/FSharp.Analyzers/PartialAppAnalyzer.fs b/src/FSharp.Analyzers/PartialAppAnalyzer.fs index f4394ce..05d4178 100644 --- a/src/FSharp.Analyzers/PartialAppAnalyzer.fs +++ b/src/FSharp.Analyzers/PartialAppAnalyzer.fs @@ -33,16 +33,23 @@ module PartialAppAnalyzer = visitExpr handler argExpr | SynExpr.App (funcExpr = SynExpr.Ident i) -> handler (i.idText, i.idRange, 1 + depth) | SynExpr.App (funcExpr = SynExpr.LongIdent (longDotId = longDotId) ; argExpr = argExpr) -> - let (SynIdent.SynIdent (ident = ident)) = longDotId.IdentsWithTrivia |> Seq.last - handler (ident.idText, longDotId.Range, 1 + depth) + longDotId.IdentsWithTrivia + |> Seq.tryLast + |> Option.iter (fun (SynIdent.SynIdent (ident = ident)) -> + handler (ident.idText, longDotId.Range, 1 + depth) + ) + visitApp handler depth argExpr | SynExpr.App (funcExpr = SynExpr.App _ as funcExpr ; argExpr = argExpr) -> visitApp handler (1 + depth) funcExpr visitApp handler depth argExpr | SynExpr.App (funcExpr = SynExpr.TypeApp (expr = SynExpr.Ident i)) -> handler (i.idText, i.idRange, 1 + depth) | SynExpr.App (funcExpr = SynExpr.TypeApp (expr = SynExpr.LongIdent (longDotId = longDotId))) -> - let (SynIdent.SynIdent (ident = ident)) = longDotId.IdentsWithTrivia |> Seq.last - handler (ident.idText, longDotId.Range, 1 + depth) + longDotId.IdentsWithTrivia + |> Seq.tryLast + |> Option.iter (fun (SynIdent.SynIdent (ident = ident)) -> + handler (ident.idText, longDotId.Range, 1 + depth) + ) | SynExpr.IfThenElse (ifExpr = ifExpr ; thenExpr = thenExpr ; elseExpr = elseExpr) -> visitApp handler depth ifExpr visitApp handler depth thenExpr