Skip to content

Commit

Permalink
Core: rename generic type
Browse files Browse the repository at this point in the history
Enhanced code readability by substituting `'Type` with more
meaningful parameter names.
  • Loading branch information
Mersho committed Jan 9, 2024
1 parent 9c4d833 commit 66f4229
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/FSharpLint.Core/Framework/HintParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ module HintParser =
let charListToString charList =
Seq.fold (fun x y -> x + y.ToString()) String.Empty charList

let pischar chars : Parser<char, 'Type> =
let pischar chars : Parser<char, 'CharParser> =
satisfy (fun x -> List.exists ((=) x) chars)

let pnotchar chars : Parser<char, 'Type> =
let pnotchar chars : Parser<char, 'CharParser> =
satisfy (fun x -> not <| List.exists ((=) x) chars)

module Operators =
Expand Down Expand Up @@ -784,22 +784,22 @@ module HintParser =
satisfy isLetter
.>> notFollowedBy (satisfy isLetter)

let ptuple (pparser:Parser<'Type, unit>) : Parser<'Type list, unit> =
let ptuple (pparser:Parser<'Element, unit>) : Parser<'Element list, unit> =
skipChar '('
>>. pparser
.>> skipChar ','
.>>. sepEndBy1 pparser (skipChar ',')
.>> skipChar ')'
|>> fun (func, rest) -> (func::rest)

let plist (pparser:Parser<'Type, unit>): Parser<'Type list, unit> =
let plist (pparser:Parser<'Element, unit>): Parser<'Element list, unit> =
skipChar '['
>>. spaces
>>. sepEndBy pparser (skipChar ';')
.>> spaces
.>> skipChar ']'

let parray (pparser:Parser<'Type, unit>): Parser<'Type list, unit> =
let parray (pparser:Parser<'Element, unit>): Parser<'Element list, unit> =
skipString "[|"
>>. spaces
>>. sepEndBy pparser (skipChar ';')
Expand Down
4 changes: 2 additions & 2 deletions src/FSharpLint.Core/Framework/ParseFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ module ParseFile =
| AbortedTypeCheck

[<NoComparison>]
type ParseFileResult<'Type> =
type ParseFileResult<'Content> =
| Failed of ParseFileFailure
| Success of 'Type
| Success of 'Content

let private parse file source (checker:FSharpChecker, options) =
let sourceText = SourceText.ofString source
Expand Down
4 changes: 2 additions & 2 deletions src/FSharpLint.Core/Rules/Conventions/Naming/NamingHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ let isImplicitModule (SynModuleOrNamespace.SynModuleOrNamespace(longIdent, _, mo
// TODO: does SynModuleOrNamespaceKind.AnonModule replace this check?
isModule moduleKind && longIdent |> List.forall (fun x -> zeroLengthRange x.idRange)

type GetIdents<'Type> = AccessControlLevel -> SynPat -> 'Type []
type GetIdents<'Item> = AccessControlLevel -> SynPat -> 'Item []

/// Recursively get all identifiers from pattern using provided getIdents function and collect them into array.
/// accessibility parameter is passed to getIdents, and can be narrowed down along the way (see checkAccessibility).
let rec getPatternIdents<'Type> (accessibility:AccessControlLevel) (getIdents:GetIdents<'Type>) argsAreParameters (pattern:SynPat) =
let rec getPatternIdents<'Item> (accessibility:AccessControlLevel) (getIdents:GetIdents<'Item>) argsAreParameters (pattern:SynPat) =
match pattern with
| SynPat.LongIdent(_, _, _, args, access, _) ->
let identAccessibility = checkAccessibility accessibility access
Expand Down

0 comments on commit 66f4229

Please sign in to comment.