Skip to content

Use property getter instead of irGetField in replaceByRegexp#82

Merged
aafanasev merged 1 commit into
masterfrom
fix/69-ir-getter-consistency
Mar 28, 2026
Merged

Use property getter instead of irGetField in replaceByRegexp#82
aafanasev merged 1 commit into
masterfrom
fix/69-ir-getter-consistency

Conversation

@aafanasev
Copy link
Copy Markdown
Owner

replaceByRegexp was using irGetField(...) to read property values directly from the backing field, while maskPropertiesInToStringFunction (the other branch of the same logic) uses irCall(property.getter!!.symbol).

Direct field access bypasses property accessors and would produce incorrect results for properties with custom getters.

Fix: replace all three irGetField usages with getter calls via a local propertyValue() lambda, consistent with the rest of the transformer.

Closes #69

@aafanasev aafanasev force-pushed the fix/69-ir-getter-consistency branch 2 times, most recently from aa83397 to b8e9235 Compare March 28, 2026 03:55
Direct backing field access bypasses property accessors and is
inconsistent with maskPropertiesInToStringFunction which already
uses irCall(property.getter!!.symbol). A local propertyValue()
lambda avoids repeating the getter call expression three times.

Closes #69

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aafanasev aafanasev force-pushed the fix/69-ir-getter-consistency branch from b8e9235 to 76ecea7 Compare March 28, 2026 03:56
@aafanasev aafanasev merged commit 2eef8c0 into master Mar 28, 2026
1 check passed
@aafanasev aafanasev deleted the fix/69-ir-getter-consistency branch March 28, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent property access: irGetField vs getter in IR transformer

1 participant