Skip to content

Commit ab184eb

Browse files
committed
shadowing in the QL language specification
1 parent 65863f1 commit ab184eb

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,32 @@ The program is invalid if any of these environments is not definite.
133133
Module environments
134134
~~~~~~~~~~~~~~~~~~~
135135

136-
For each of modules, types, and predicates, a module *imports*, *declares*, and *exports* an environment. These are defined as follows (with X denoting the type of entity we are currently considering):
136+
For each of modules, types, predicates, module signatures, type signatures, and predicates signatures, we distinguish five environments: *publically declared*, *privately declared*, *exported*, and *visible*.
137+
These are defined as follows (with X denoting the type of entity we are currently considering):
137138

138-
- The *imported X environment* of a module is defined to be the union of the exported X environments of all the modules which the current module directly imports (see "`Import directives <#import-directives>`__").
139+
- The *privately declared X environment* of a module is the multimap of X declarations and aliases in the module itself that are annotated as ``private``.
139140

140-
- The *declared X environment* of a module is the multimap of X declarations in the module itself.
141+
- The *publically declared X environment* of a module is the multimap of X declarations and aliases in the module itself that are not annotated as ``private``.
141142

142-
- The *exported X environment* of a module is the union of the exported X environments of the modules which the current module directly imports (excluding ``private`` imports), and the declared X environment of the current module (excluding ``private`` declarations).
143+
- The *exported X environment* of a module is the union of
143144

144-
- The *external X environment* of a module is the visible X environment of the enclosing module, if there is one, and otherwise the global X environment.
145+
1. its *publically declared X environment*, and
145146

146-
- The *visible X environment* is the union of the imported X environment, the declared X environment, and the external X environment.
147+
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.
148+
149+
- The *visible X environment* of a module is the union of
150+
151+
1. its *exported X environment*, and
152+
153+
2. its *privately declared X environment*, and
154+
155+
3. the *global X environment*, and
156+
157+
4. for each module which the current module privately imports: all entries from the *exported X environment* that have a key not present in the *publically declared X environment* of the current module, and
158+
159+
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
160+
161+
6. all parameters of the current module that are of type X.
147162

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

0 commit comments

Comments
 (0)