Skip to content

dyno: Begin resolving method calls and initializer calls#19359

Merged
dlongnecke-cray merged 11 commits intochapel-lang:mainfrom
dlongnecke-cray:dyno-resolve-methods-initializers
Mar 31, 2022
Merged

dyno: Begin resolving method calls and initializer calls#19359
dlongnecke-cray merged 11 commits intochapel-lang:mainfrom
dlongnecke-cray:dyno-resolve-methods-initializers

Conversation

@dlongnecke-cray
Copy link
Contributor

@dlongnecke-cray dlongnecke-cray commented Mar 4, 2022

dyno: Begin resolving method calls and new calls (#19359)

Begin resolving method calls and new calls in the dyno resolver.
The goal is to handle simple cases such a record with a zero argument
primary or secondary method, or a 'new r' for a record 'r'.

When resolving a 'new' expression also resolve an initializer call
as a side effect.

FUTURE WORK

  • Resolve class types and class management
  • Use the resulting initializer to compute the final 'new' type
  • If the initializer is not compiler-generated, resolve the body
    in order to determine the final type
  • Tests for generic/param types
  • Verify that POI stuff is working as expected in tests

Reviewed by @mppf. Thanks!

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
@dlongnecke-cray dlongnecke-cray marked this pull request as ready for review March 14, 2022 18:01
Copy link
Member

@mppf mppf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see slightly more effort for draft code computing the POI details before merging. I'm not expecting that is too hard (just do a similar thing to the normal call resolution process).

ci,
poi);

// TODO: also add POI info?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean, TODO: also adjust poiInfo.

Seems to me you could make something based on this existing code:

  if (anyInstantiated) {
    instantiationPoiScope =
      pointOfInstantiationScope(context, inScope, inPoiScope);
    poiInfo.setPoiScope(instantiationPoiScope);
  }

  for (const TypedFnSignature* candidate : mostSpecific) {
    if (candidate != nullptr) {
      if (candidate->untyped()->idIsFunction()) {
        accumulatePoisUsedByResolvingBody(context, candidate,
                                          instantiationPoiScope, poiInfo);
      }
    }
  }

Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
@dlongnecke-cray dlongnecke-cray merged commit d3784d2 into chapel-lang:main Mar 31, 2022
@mppf mppf mentioned this pull request Apr 1, 2022
1 task
mppf added a commit that referenced this pull request Apr 1, 2022
Fix problem compiling with GCC 5

Follow-up to PR #19359.

GCC 5 doesn't include `std::hash` for enum types so we have to
add our own versions for our enum types when they are needed.

Trivial and not reviewed.

- [x] verified that `CC=gcc-5 CXX=g++-5 make` works on my system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants