spcl / spcl/dace

Drop str() casts in replace/replace_dict and fix callers that pass non-string replacements

Open
#2,591 0 comments 0 reactions 0 assignees View on GitHub
core enhancement good first issue
Dominant language
Python
Stars
593
Forks
163
Avg merge
2d 23h
Merged PRs (30d)
60

Description

`replace` / `replace_dict` are typed `Dict[str, str]`, but some callers pass other types. `symbolic.safe_replace` hands its callback sympy symbols (default `value_as_string=False`), and `LoopUnroll` passes the loop index as a number. #2583 converts these back with `str()` where names are stored (`LoopRegion.loop_variable`, interstate edge assignment keys). That also silently stores non-identifiers such as `"3"`.

Proposal: remove the `str()` casts, make `replace`/`replace_dict` reject non-string replacement values, and fix the offending callers at the source. This touches many call sites and needs a full CI run (see the discussion in #2583).

Contributor guide

Open the contributing guide

Research direction

Locate replace and replace_dict, then trace the callers named in the issue: symbolic.safe_replace and LoopUnroll, along with the storage points discussed in #2583. Make replacement values string-only at the replacement functions, correct the offending callers at their source, and run the full CI suite to verify that non-identifiers are no longer silently stored.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.