Commit 2e055ab
authored
Fix self.field.method() calls bypassing dispatch resolution (#1085)
Fixes #1082
`self.field.method()` calls inside class methods were bypassing dispatch
resolution. The type inference for `self` fell through to `Package`, so
chained calls like `self.store.put_item(...)` were flattened into
underscore-separated package calls instead of resolving through the
field's type and dispatching to the correct spec.
The fix registers `self` with the current class name in `variableTypes`
during method body translation, so `inferExprType` can resolve `self` →
class → field type → correct method dispatch.
Tested with a new end-to-end test that verifies `self.store.put_item()`
correctly dispatches through the Storage spec and detects a precondition
violation. Existing tests pass.1 parent 641d967 commit 2e055ab
3 files changed
Lines changed: 41 additions & 0 deletions
File tree
- StrataTestExtra/Languages/Python
- Specs/dispatch_test
- Strata/Languages/Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2213 | 2213 | | |
2214 | 2214 | | |
2215 | 2215 | | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
2216 | 2219 | | |
2217 | 2220 | | |
2218 | 2221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
386 | 411 | | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments