[Chapel Merge] Fix generic record initialization when substitutio

Branch: refs/heads/main
Revision: 593fba9
Author: dlongnecke-cray
Link: Fix generic record initialization when substitution is a runtime type by dlongnecke-cray · Pull Request #19220 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19220 from dlongnecke-cray/fix-default-init-generic-record-rtt

Fix generic record initialization when substitution is a runtime type

Attempt to recover runtime types used in the type construction of
default initialized records. This fixes some cases where a
default initialized record containing an array or domain field
would halt at runtime when said field was used.

Resolves #19118.
Resolves #20167.

The parent issue for this effort is: #15929.

Also consider: #19292, #20424

This PR does not fix all bugs related to default initialization of
aggregates that contain runtime types. The bug persists when
a type constructor containing a runtime type is obfuscated by
indirection (e.g, it is returned by a function, or uses 2+ levels of
type alias). See the added future RuntimeTypeEscapes.chpl for an
example.

Reviewed by @vasslitvinov. Thanks!

TESTING

  • ALL on linux64, standard

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

Modified Files:
A test/types/records/bugs/CacheDom.chpl

A test/types/records/bugs/CacheDom.good
A test/types/records/bugs/DefaultInitGenericRecordRuntimeType.chpl
A test/types/records/bugs/DefaultInitGenericRecordRuntimeType.good
A test/types/records/bugs/RuntimeTypeEscapes.bad
A test/types/records/bugs/RuntimeTypeEscapes.chpl
A test/types/records/bugs/RuntimeTypeEscapes.future
A test/types/records/bugs/RuntimeTypeEscapes.good
M compiler/AST/CallExpr.cpp
M compiler/AST/astutil.cpp
M compiler/include/astutil.h
M compiler/optimizations/inferConstRefs.cpp
M compiler/resolution/cleanups.cpp
M compiler/resolution/functionResolution.cpp
M compiler/resolution/postFold.cpp
M test/parallel/sync/bradc/testSyncSingleTypes.chpl

Compare: https://github.com/chapel-lang/chapel/compare/4ede1205ff11...593fba9decf7