Add type checking code to IdentifiedStructType.set_body ?
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 373
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 10
Description
Hello. I didn't read the documentation well and in ir.types to structtype.set_body() passed list. So maybe it would be good if set_body function code will be as or like below?
```
def set_body(self, *elems):
if not self.is_opaque:
raise RuntimeError("{name} is already defined".format(
name=self.name))
for e in elems:
if not isinstance(e,Type):
raise RuntimeError("{} is not ir.Type instance".format(e))
self.elements = tuple(elems)
```
added Type checking.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in ir.types by locating the IdentifiedStructType/StructType set_body implementation and checking how its arguments are currently handled. Confirm the intended behavior from the issue: reject a list or any non-Type element, while accepting Type instances; verify the resulting error and accepted input behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100