---
name: "Ast_invariants"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Ast_invariants"
---

# Ast\_invariants(3o)

Check AST invariants

## NAME

Ast\_invariants - Check AST invariants

## Module

Module   Ast\_invariants

## Documentation

Module **Ast\_invariants**\
  :  **sig end**

Check AST invariants

Warning: this module is unstable and part of **Compiler\_libs** .

*val structure* :  **Parsetree.structure -\> unit**

*val signature* :  **Parsetree.signature -\> unit**

*val check\_loc\_ghost* :  **(Ast\_iterator.iterator -\> Ast\_iterator.iterator -\> 'a -\> unit) -\>** **'a -\> source\_contents:string -\> unit**

Checks the invariant of Location.t's loc\_ghost field, that are stated in location.mli. This can be run with -dparsetree-loc-ghost-invariants, which is used slightly in the testsuite, but should be used more to find more of the places where the invariant is broken.
