Skip to content

Commit 09fdf74

Browse files
committed
introduce module signature member defaults
1 parent 4e7ca1a commit 09fdf74

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/codeql/ql-language-reference/signatures.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,24 @@ In detail, a type signature definition consists of:
8383
#. The name of the module signature. This is an `identifier <https://codeql.github.com/docs/ql-language-reference/ql-language-specification/#identifiers>`_
8484
starting with a uppercase letter.
8585
#. Optionally, a list of parameters for :ref:`parameterized module signatures <parameterized-module-signatures>`.
86-
#. The module signature body, consisting of type signatures and predicate signatures enclosed in braces.
86+
#. The module signature body, consisting of type signatures, predicate signatures, and default predicates enclosed in braces.
8787
The ``signature`` keyword is omitted for these contained signatures.
8888

89+
Module signature default predicates are syntactically constructed like predicate signatures,
90+
but preceded by the ``default`` keyword, and with a predicate body instead of the concluding
91+
semicolon ``;``.
92+
Default predicate bodies are restricted in that they may not use entities that in any way
93+
depend on other module signature members or parameters of the module signature or any
94+
existing enclosing modules.
95+
8996
For example:
9097

9198
.. code-block:: ql
9299
93100
signature module MSig {
94101
class T;
95102
predicate restriction(T t);
103+
default string descr(T t) { result = "default" }
96104
}
97105
98106
module Module implements MSig {

0 commit comments

Comments
 (0)