Skip to content

Fix array return types for tuples of arrays - #29241

Open
jabraham17 wants to merge 11 commits into
chapel-lang:mainfrom
jabraham17:fix-array-return
Open

Fix array return types for tuples of arrays#29241
jabraham17 wants to merge 11 commits into
chapel-lang:mainfrom
jabraham17:fix-array-return

Conversation

@jabraham17

@jabraham17 jabraham17 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Fixes an issue where explicit return types of a tuple of arrays (either anonymous domains or generic return types) would fail with obscure errors

fixes #29235

I ended up fixing several other issues while here

  • Fixed a return type of [] not being checked to be an array
  • Fixed a bad error message when trying to coerce to a return type of [] int (unknown domain)
  • Fixed a bad error message when trying to coerce to a return type of [D] (unknown type)

I also found #29261 and filed futures for it

[Reviewed by @]

Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
@jabraham17
jabraham17 requested a review from benharsh August 14, 2026 18:07

@benharsh benharsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Just one note about a new error message.

auto retCall = toCallExpr(retExpr);
if (typeCall && typeCall->isNamed("_build_tuple")) {
if (!(retCall && retCall->isNamed("_build_tuple"))) {
USR_FATAL(fn, "return type is a tuple, but return value is not");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this have a test case?

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.

[Bug]: Cannot use explicit return type for tuple of arrays

2 participants