Skip to content

Commit 0b62a1d

Browse files
authored
Merge pull request github#3144 from ginsbach/setliteralhandbook
Mention set literals in handbook
2 parents 875a70c + 05be9b8 commit 0b62a1d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/language/ql-handbook/expressions.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ In a valid range, the start and end expression are integers, floats, or dates. I
9595
is a date, then both must be dates. If one of them is an integer and the other a float, then
9696
both are treated as floats.
9797

98+
.. index:: setliteral
99+
.. _setliteral:
100+
101+
Set literal expressions
102+
***********************
103+
104+
A set literal expression allows the explicit listing of a choice between several values.
105+
It consists of a comma-separated collection of expressions that are enclosed in brackets (``[`` and ``]``).
106+
For example, ``[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]`` is a valid set literal expression.
107+
Its values are the first ten prime numbers.
108+
109+
The values of the contained expressions need to be of :ref:`compatible types <type-compatibility>` for a valid set literal expression.
110+
Furthermore, at least one of the set elements has to be of a type that is a supertype of the types of all
111+
the other contained expressions.
112+
113+
Set literals are supported from release 2.1.0 of the CodeQL CLI, and release 1.24 of LGTM Enterprise.
114+
98115
.. index:: super
99116
.. _super:
100117

0 commit comments

Comments
 (0)