Skip to content

Commit

Permalink
Fix mishandled implicit boolean assignment for donttest/dontcompare p…
Browse files Browse the repository at this point in the history
…roperties. #167
  • Loading branch information
amykyta3 committed Apr 10, 2023
1 parent a0153ac commit eaaff7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion systemrdl/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.25.5"
__version__ = "1.25.6"
13 changes: 9 additions & 4 deletions systemrdl/properties/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .. import component as comp
from .. import node as m_node
from ..ast.cast import AssignmentCast
from ..ast.ast_node import ASTNode
from .. import rdltypes

if TYPE_CHECKING:
Expand Down Expand Up @@ -64,8 +65,10 @@ def assign_value(self, comp_def: comp.Component, value: Any, src_ref: 'SourceRef
# If assigned to any other components, exclusively cast it to a boolean
if not isinstance(comp_def, comp.Field):
value = comp_def.properties[self.get_name()]
value = AssignmentCast(self.env, src_ref, value, bool)
comp_def.properties[self.get_name()] = value
if isinstance(value, ASTNode):
# was not an implicit True assignment
value = AssignmentCast(self.env, src_ref, value, bool)
comp_def.properties[self.get_name()] = value

def validate(self, node: m_node.Node, value: Any) -> None:
donttest = node.get_property('donttest')
Expand Down Expand Up @@ -145,8 +148,10 @@ def assign_value(self, comp_def: comp.Component, value: Any, src_ref: 'SourceRef
# If assigned to any other components, exclusively cast it to a boolean
if not isinstance(comp_def, comp.Field):
value = comp_def.properties[self.get_name()]
value = AssignmentCast(self.env, src_ref, value, bool)
comp_def.properties[self.get_name()] = value
if isinstance(value, ASTNode):
# was not an implicit True assignment
value = AssignmentCast(self.env, src_ref, value, bool)
comp_def.properties[self.get_name()] = value

def validate(self, node: m_node.Node, value: Any) -> None:
if isinstance(node, m_node.FieldNode):
Expand Down

0 comments on commit eaaff7c

Please sign in to comment.