Skip to content

Commit

Permalink
More informative warning when feature is already defined in parent.
Browse files Browse the repository at this point in the history
  • Loading branch information
zesch committed Jan 11, 2024
1 parent e05ef70 commit 0b1823f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cassis/typesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,10 @@ def _add_feature(self, feature: Feature, inherited: bool = False, warn: bool = T
redefined_feature = self._inherited_features[feature.name]

if redefined_feature != feature:
msg = f"Feature with name [{feature.name}] already exists in parent but is redefined!"
msg = f"For type [{self.name}] feature with name [{feature.name}] already exists in parent [{self.supertype.name}] but is redefined!"
raise ValueError(msg)
elif warn:
msg = f"Feature with name [{feature.name}] already exists in parent!"
msg = f"For type [{self.name}] feature with name [{feature.name}] already exists in parent [{self.supertype.name}]!"
warnings.warn(msg)
return

Expand Down

0 comments on commit 0b1823f

Please sign in to comment.