Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions docs/codeql/ql-language-reference/ql-language-specification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,19 @@ Global environments

The global module environment has a single entry ``QlBuiltins``.

The global type environment has entries for the primitive types ``int``, ``float``, ``string``, ``boolean``, and ``date``, as well as any types defined in the database schema.
The global type environment has entries for the primitive types ``int``, ``float``, ``string``, ``boolean``, and ``date``.

The global predicate environment includes all the built-in classless predicates, as well as any extensional predicates declared in the database schema.
The global predicate environment includes all the built-in classless predicates.

The three global signature environments are empty.

Database schema environments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The database schema type environment has entries for types declared in the database schema.

The database schema predicate environment has entries for extensional predicates declared in the database schema.

The program is invalid if any of these environments is not definite.

Module environments
Expand All @@ -146,7 +153,7 @@ These are defined as follows (with X denoting the type of entity we are currentl

2. for each module which the current module directly imports (excluding ``private`` imports - see "`Import directives <#import-directives>`__"): all entries from the *exported X environment* that have a key not present in the *publically declared X environment* of the current module, and

3. if X is ``predicates``, then for each module signature ``S`` that is implemented by the current module: an entry for each module signature default predicate in ``S`` that does not have the same name and arity as any of the entries in the **publically declared predicate environment** of the current module.
3. if X is ``predicate``, then for each module signature ``S`` that is implemented by the current module: an entry for each module signature default predicate in ``S`` that does not have the same name and arity as any of the entries in the **publically declared predicate environment** of the current module.

- The *visible X environment* of a module is the union of

Expand All @@ -160,7 +167,9 @@ These are defined as follows (with X denoting the type of entity we are currentl

5. if there is an enclosing module: all entries from the *visible X environment* of the enclosing module that have a key not present in the *publically declared X environment* of the current module, and

6. all parameters of the current module that are of type X.
6. if there is no enclosing module and X is either ``type`` or ``predicate``: all entries from the *database schema X environment* that have a key not present in the *publically declared X environment* of the current module, and

7. all parameters of the current module that are of type X.

The program is invalid if any of these environments is not definite.

Expand Down