anchor.diff:                  odef.SelectionSet
                   |> collectResults (fragmentSpreadTargetDefinedInSelection fragmentDefinitionNames path))
   
  -    let rec private checkFragmentMustNotHaveCycles (fragmentDefinitions : FragmentDefinition list) (visited : string list ref) (validated : string list ref) (frag : FragmentDefinition) =
  -        frag.Name
  -        |> Option.map (fun name ->
  -            if List.contains name !visited
  -            then
  -                if not (List.contains name !validated) then
  -                    validated := name :: !validated
  -                    AstError.AsResult(sprintf "Fragment '%s' is making a cyclic reference." name)
  -                else Success
  -            else
  -                visited := name :: !visited
  -                frag.SelectionSet
  -                |> collectResults (checkFragmentsMustNotHaveCyclesInSelection fragmentDefinitions (ref !visited) (ref !validated)))
  -        |> Option.defaultValue Success
  +    let rec private checkFragmentMustNotHaveCycles (fragmentDefinitions : FragmentDefinition list) (visited : string list ref) (validated : string list ref) (fragName : string) (fragSelectionSet : Selection list) =
  +        if List.contains fragName !visited
  +        then
  +            if not (List.contains fragName !validated) then
  +                validated := fragName :: !validated
  +                AstError.AsResult(sprintf "Fragment '%s' is making a cyclic reference." fragName)
  +            else Success
  +        else
  +            visited := fragName :: !visited
  +            fragSelectionSet
  +            |> collectResults (checkFragmentsMustNotHaveCyclesInSelection fragmentDefinitions (ref !visited) (ref !validated))
   
       and private checkFragmentsMustNotHaveCyclesInSelection (fragmentDefinitions : FragmentDefinition list) (visited : string list ref) (validated : string list ref) =
           function
           | Field field ->
               field.SelectionSet
               |> collectResults (checkFragmentsMustNotHaveCyclesInSelection fragmentDefinitions (ref !visited) (ref !validated))
  -        | InlineFragment frag -> checkFragmentMustNotHaveCycles fragmentDefinitions visited validated frag
           | FragmentSpread spread ->
               match fragmentDefinitions |> List.tryFind (fun f -> f.Name.IsSome && f.Name.Value = spread.Name) with
  -            | Some frag -> checkFragmentMustNotHaveCycles fragmentDefinitions visited validated frag
  +            | Some frag -> checkFragmentMustNotHaveCycles fragmentDefinitions visited validated spread.Name frag.SelectionSet
               | None -> Success
  +        | _ -> Success
   
       let internal validateFragmentsMustNotFormCycles (ctx : ValidationContext) =
  -        let fragmentDefinitions = ctx.FragmentDefinitions |> List.map (fun x -> x.Definition)
  -        fragmentDefinitions
  -        |> collectResults (fun x -> checkFragmentMustNotHaveCycles fragmentDefinitions (ref []) (ref []) x)
  +        let fragmentDefinitions = ctx.FragmentDefinitions |> List.map (fun frag -> frag.Definition)
  +        let fragNamesAndSelections = fragmentDefinitions |> List.choose (fun frag -> frag.Name |> Option.map (fun x -> x, frag.SelectionSet))
  +        fragNamesAndSelections
  +        |> collectResults (fun (name, selectionSet) -> checkFragmentMustNotHaveCycles fragmentDefinitions (ref []) (ref []) name selectionSet)
   
       let private checkFragmentSpreadIsPossibleInSelection (path : Path, parentType : IntrospectionType, fragmentType : IntrospectionType) =
           if not (typesAreApplicable (parentType, fragmentType))
  
positive.code:                     |> Option.bind ctx.Schema.TryGetTypeByName
                      |> Option.map (fun fragType ->
                          let fragType = (Spread (fragSpread.Name, fragSpread.Directives, fragType))
                          getFragSelectionSetInfo (ref !visitedFragments) fragType fragDef.SelectionSet ctx))
                  |> Option.defaultValue List.empty)
  
      let private getOperationDefinitions (ast : Document) = 
  
negative.code:                 field.Directives
                  |> collectResults (validateDirective schemaInfo path DirectiveLocation.FIELD (fun directiveDef ->
                      sprintf "Field or alias '%s' has a directive '%s', but this directive location is not supported by the schema definition." field.AliasOrName directiveDef.Name))
              let directivesValidInSelectionSet =
                  field.SelectionSet
                  |> collectResults (checkDirectivesInValidLocationOnSelection schemaInfo fragmentDefinitions path)
              directivesValid @@ directivesValidInSelectionSet
          | InlineFragment frag -> 
              let fragCtx =
                  { Schema = schemaInfo
                    FragmentDefinitions = fragmentDefinitions
                    Path = path
                    Directives = frag.Directives
                    SelectionSet = frag.SelectionSet }
              checkDirectivesInValidLocationOnInlineFragment fragCtx
          | _ -> Success // We don't validate spreads here, they are being validated in another function
  
      type private FragmentSpreadContext =
          { Schema : SchemaInfo
            FragmentDefinitions : FragmentDefinition list
            Path : Path
            FragmentName : string
            Directives : Directive list
            SelectionSet : Selection list }
  
      let rec private checkDirectivesInValidLocationOnFragmentSpread (ctx : FragmentSpreadContext) =
          let directivesValid =
              ctx.Directives
              |> collectResults (validateDirective ctx.Schema ctx.Path DirectiveLocation.FRAGMENT_SPREAD (fun d -> 
                  sprintf "Fragment '%s' has a directive '%s', but this directive location is not supported by the schema definition." ctx.FragmentName d.Name))
          let directivesValidInSelectionSet =
              ctx.SelectionSet
              |> collectResults (checkDirectivesInValidLocationOnSelection ctx.Schema ctx.FragmentDefinitions ctx.Path)
          directivesValid @@ directivesValidInSelectionSet
  
      let private checkDirectivesInOperation (schemaInfo : SchemaInfo) (fragmentDefinitions : FragmentDefinition list) (path : Path) (operation : OperationDefinition) =
          let expectedLocation =
              match operation.OperationType with
              | Query -> DirectiveLocation.QUERY
  