Skip to content

Commit 30a813a

Browse files
committed
QL language specs: declarations can shadow dbscheme types and preds
1 parent 44b734e commit 30a813a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,19 @@ Global environments
122122

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

125-
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.
125+
The global type environment has entries for the primitive types ``int``, ``float``, ``string``, ``boolean``, and ``date``.
126126

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

129129
The three global signature environments are empty.
130130

131+
Database schema environments
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133+
134+
The database schema type environment has entries for types declared in the database schema.
135+
136+
The database schema predicate environment has entries for extensional predicates declared in the database schema.
137+
131138
The program is invalid if any of these environments is not definite.
132139

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

147154
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
148155

149-
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.
156+
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.
150157

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

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

161168
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
162169

163-
6. all parameters of the current module that are of type X.
170+
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
171+
172+
7. all parameters of the current module that are of type X.
164173

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

0 commit comments

Comments
 (0)