Skip to content

Commit

Permalink
Remove element restrictions of compile-time list expressions -- SIMIC…
Browse files Browse the repository at this point in the history
…S-13113
  • Loading branch information
lwaern-intel committed Jan 30, 2025
1 parent ea00bb8 commit 75d51eb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 43 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,5 @@
as Coverity support is enabled by passing `--coverity` to DMLC.
- `release 6 6356`
- `release 7 7060`
- `note 6` Elements of compile-time list expressions are now allowed to be
non-constant expressions (fixes SIMICS-13113).
2 changes: 1 addition & 1 deletion doc/1.4/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -4163,7 +4163,7 @@ be consistent.
</pre>

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

Expand Down
12 changes: 2 additions & 10 deletions py/dml/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,16 +1301,8 @@ def expr_slice(tree, location, scope):
@expression_dispatcher
def expr_list(tree, location, scope):
[elts] = tree.args
values = []
for elt in elts:
e = codegen_expression_maybe_nonvalue(elt, location, scope)
if e.constant or isinstance(e, (NodeRef, AbstractList, NodeArrayRef,
SessionVariableRef)):
values.append(e)
elif isinstance(e, NonValue):
raise e.exc()
else:
raise ECLST(e)
values = [codegen_expression_maybe_nonvalue(elt, location, scope)
for elt in elts]
return mkList(tree.site, values)

@expression_dispatcher
Expand Down
6 changes: 0 additions & 6 deletions py/dml/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,6 @@ class EAVAR(DMLError):
"""
fmt = "cannot use variable index in a constant list"

class ECLST(DMLError):
"""
Lists may only contain constants.
"""
fmt = "non-constant element in list"

class ENLST(DMLError):
"""
A list was expected.
Expand Down
26 changes: 0 additions & 26 deletions test/1.2/errors/T_ECLST.dml

This file was deleted.

0 comments on commit 75d51eb

Please sign in to comment.