Skip to content

Commit 75d51eb

Browse files
committed
Remove element restrictions of compile-time list expressions -- SIMICS-13113
1 parent ea00bb8 commit 75d51eb

File tree

5 files changed

+5
-43
lines changed

5 files changed

+5
-43
lines changed

RELEASENOTES.md

+2
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,5 @@
228228
as Coverity support is enabled by passing `--coverity` to DMLC.
229229
- `release 6 6356`
230230
- `release 7 7060`
231+
- `note 6` Elements of compile-time list expressions are now allowed to be
232+
non-constant expressions (fixes SIMICS-13113).

doc/1.4/language.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4163,7 +4163,7 @@ be consistent.
41634163
</pre>
41644164

41654165
A list is a *compile-time only* value, and is an ordered sequence
4166-
of zero or more compile-time constant values. Lists are in particular
4166+
of zero or more expressions. Lists are in particular
41674167
used in combination with `foreach` and `select`
41684168
statements.
41694169

py/dml/codegen.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -1301,16 +1301,8 @@ def expr_slice(tree, location, scope):
13011301
@expression_dispatcher
13021302
def expr_list(tree, location, scope):
13031303
[elts] = tree.args
1304-
values = []
1305-
for elt in elts:
1306-
e = codegen_expression_maybe_nonvalue(elt, location, scope)
1307-
if e.constant or isinstance(e, (NodeRef, AbstractList, NodeArrayRef,
1308-
SessionVariableRef)):
1309-
values.append(e)
1310-
elif isinstance(e, NonValue):
1311-
raise e.exc()
1312-
else:
1313-
raise ECLST(e)
1304+
values = [codegen_expression_maybe_nonvalue(elt, location, scope)
1305+
for elt in elts]
13141306
return mkList(tree.site, values)
13151307

13161308
@expression_dispatcher

py/dml/messages.py

-6
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,6 @@ class EAVAR(DMLError):
530530
"""
531531
fmt = "cannot use variable index in a constant list"
532532

533-
class ECLST(DMLError):
534-
"""
535-
Lists may only contain constants.
536-
"""
537-
fmt = "non-constant element in list"
538-
539533
class ENLST(DMLError):
540534
"""
541535
A list was expected.

test/1.2/errors/T_ECLST.dml

-26
This file was deleted.

0 commit comments

Comments
 (0)