Skip to content

Commit a09c12a

Browse files
authored
Merge pull request github#5537 from alexet/ambig-super
Docs: Update the language specification for changes to super.
2 parents a7030c7 + b21672c commit a09c12a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,8 +1116,6 @@ A super expression may only occur in a QL program as the receiver expression for
11161116

11171117
If a super expression includes a ``type``, then that type must be a class that the enclosing class inherits from.
11181118

1119-
If the super expression does not include a type, then the enclosing class must have a single declared base type, and that base type must be a class.
1120-
11211119
The value of a super expression is the same as the value of ``this`` in the named tuple.
11221120

11231121
Casts
@@ -1169,7 +1167,12 @@ A valid call with results *resolves* to a set of predicates. The ways a call can
11691167

11701168
- If the call has no receiver and the predicate name is a selection identifier, then the qualifier is resolved as a module (see "`Module resolution <#module-resolution>`__"). The identifier is then resolved in the exported predicate environment of the qualifier module.
11711169

1172-
- If the call has a super expression as the receiver, then it resolves to a member predicate in a class the enclosing class inherits from. If the super expression is unqualified, then the super-class is the single class that the current class inherits from. If there is not exactly one such class, then the program is invalid. Otherwise the super-class is the class named by the qualifier of the super expression. The predicate is resolved by looking up its name and arity in the exported predicate environment of the super-class.
1170+
- If the call has a super expression as the receiver, then it resolves to a member predicate in a class that the enclosing class inherits from:
1171+
- If the super expression is unqualified and there is a single class that the current class inherits from, then the super-class is that class.
1172+
- If the super expression is unqualified and there are multiple classes that the current class inherits from, then the super-class is the domain type.
1173+
- Otherwise, the super-class is the class named by the qualifier of the super expression.
1174+
1175+
The predicate is resolved by looking up its name and arity in the exported predicate environment of the super-class.
11731176

11741177
- If the type of the receiver is the same as the enclosing class, the predicate is resolved by looking up its name and arity in the visible predicate environment of the class.
11751178

0 commit comments

Comments
 (0)