Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dyno: Support non-local receivers and improve resolution of type quer…
…ies (#26038) This PR adds support for non-local receivers to dyno and fixes a bug affecting the resolution of type queries. It adds support for programs like the following: ```chapel class Foo { type T; proc get(type t) type do return t; proc foo() { // Here 'nested' is not a method, but 'this' is still visible as // an outer variable. It is a non-local receiver from the // parent method 'foo'. proc nested(x : get(T)) do return x; return nested(0); } } ``` Refactor the `Resolver::methodReceiverType()` method to make use of a new method `closestMethodReceiverInfo()`. Remove `getMethodReceiver` and streamline how receiver information is computed. When resolving, try to compute a local method receiver using whatever means are available. If that fails, consult stack frames for the first method that lexically encloses the current symbol and use its receiver instead. In `getMethodReceiverScopeHelper()` and friend, flatten out the branches used to make the function idempotent and to handle `scopeResolveOnly`. This makes the typed path for setting up the helper easier to digest. Fix a bug in type query resolution that caused every call to be treated as though it were a type constructor for a composite type. To do this, compute if type queries are present in children in `Resolver::resolveTypeQueries` and do nothing if they are not. Secondly, rely on the `Resolver::signatureOnly` flag to avoid emitting errors unless we are resolving a signature and have access to the types of sub-expressions. Reviewed by @mppf. Thanks!
- Loading branch information