Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyno: field type resolution using only type expression #22706

Merged
merged 4 commits into from
Jul 10, 2023

Conversation

benharsh
Copy link
Member

This PR resolves a bug in the dyno compiler where compilation could recurse through a field type's initialization expression, despite that field having a concrete type expression.

This PR adds a new field to Resolver named fieldTypesOnly. This field is set in the cases where we are creating a Resolver for the purpose of resolving a type's fields. When this property is set, resolution of a NamedDecl will check if it is the field being resolved, and if so, will attempt to only use the field's type expression (if one is available). If the type expression is not a concrete type, then resolution will proceed to resolve the field's initialization expression.

This property does not apply to type or param fields since the initialization expression is necessary in those cases (if one exists).

A minor fix is included in this PR, in which we return from resolveFnCallSpecialType if the special call is trying to be resolved as a method call (which is not valid Chapel).

Future work involves updating the initializer implementation to take responsibility for checking the compatibility of field type expressions and initialization expressions (e.g. "var x : int = "hello";).

Testing:

  • test-dyno

Updates resolution of NamedDecls to check if we are currently trying to
only resolve field types, and if so will try to only use an existing
type expression. If that type expression resolves to be non-generic,
then we will skip resolving an initialization expression.

Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
@mppf mppf self-requested a review July 10, 2023 18:04
frontend/lib/resolution/Resolver.cpp Show resolved Hide resolved
@benharsh benharsh merged commit 8c976f4 into chapel-lang:main Jul 10, 2023
7 checks passed
@benharsh benharsh deleted the resolve-field-type branch April 9, 2024 06:12
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.

2 participants