Summary
An inline specialization of a generic method reached through a with statement was created without its instance, so the call was rebuilt from the enclosing method's Self and dispatched to the wrong object (#41711), or rejected as an illegal expression (#41712).
Resolve the member read first and attach the resulting instance node to the specialize node; a non-member specialization keeps passing nil.
!1435 attaches the with-ref only; resolving the member read also covers the member-scope case of #41711, which is why this is a separate MR.
Fixes #41711, #41712. Tests: tests/webtbs/tw41711.pp, tests/webtbs/tw41712.pp.
System
- Operating system: all (verified on Windows 11)
- Processor architecture: all (verified on x86-64)
- Device: Computer
What is the current bug behavior?
tw41711.pp(112,21) Error: Illegal expression
tw41712.pp(27,28) Error: Illegal expressionWhat is the behavior after applying this patch?
Both programs compile and run with exit 0; the method is dispatched on the with instance.
Relevant logs and/or screenshots
Verified on x86_64-win64 main (2efddc1b): red before, green after. Also proposed to Unleashed Pascal as PR #43, which waits for this MR.