Skip to content

Merge i16 and i32 param and return test files #5760

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

Merged
merged 9 commits into from
Jul 16, 2025

Conversation

bricknerb
Copy link
Contributor

This is instead of having one test file that has different return types and two test files for i16 and i32 param tests, which doesn't seem consistent.
First commit does file renames for easier review.

Part of #5063.

@github-actions github-actions bot requested a review from josh11b July 2, 2025 12:45
// CHECK:STDERR: Cpp.foo(&a);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
Cpp.foo(&a);
//@dump-sem-ir-end
}

// CHECK:STDOUT: --- import_short.carbon
// ============================================================================
// short return
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving the return tests up, just after the first param test? E.g. have a short_param test, then short_return test. After that we don't need to have param in the name of each test, as the tests are not about testing param or return, but testing the type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The short param section includes multiple tests so putting the return test after it seems a bit arbitrary.
The other param tests also test pointers and references, which we might want to also test with return values at some point, so I prefer to be explicit about the use case being tested.
I'm not sure we want interleaving param and return tests, so it makes sense to me to put all return tests after all param tests.

@ivanaivanovska
Copy link
Contributor

In general it looks good to merge these files, with a small remark that I left.

One question: What are the files function_param_int16.carbon and function_param_int32.carbon? Shall they be deleted?

@bricknerb
Copy link
Contributor Author

In general it looks good to merge these files, with a small remark that I left.

One question: What are the files function_param_int16.carbon and function_param_int32.carbon? Shall they be deleted?

Yes, I've noticed that yesterday as well. I guess some rename I made didn't delete the files. Will send a fix.

@bricknerb bricknerb requested a review from ivanaivanovska July 3, 2025 07:26
@bricknerb
Copy link
Contributor Author

In general it looks good to merge these files, with a small remark that I left.
One question: What are the files function_param_int16.carbon and function_param_int32.carbon? Shall they be deleted?

Yes, I've noticed that yesterday as well. I guess some rename I made didn't delete the files. Will send a fix.

See #5768.

@josh11b josh11b removed their request for review July 3, 2025 17:02
@bricknerb bricknerb enabled auto-merge July 4, 2025 08:41
@bricknerb bricknerb requested a review from jonmeow July 4, 2025 08:42
@jonmeow jonmeow disabled auto-merge July 7, 2025 15:27
Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

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

If you're moving out int support, would it make sense to rename return.carbon to float.carbon?

@@ -6,115 +6,115 @@
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/param_int16.carbon
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/int16.carbon
Copy link
Contributor

Choose a reason for hiding this comment

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

From discussion about thunking, we expect a lot of types to behave in a similar way:

  • i32 and i64 should work without a thunk
  • i8, i16, and i128 should require a thunk
  • Similar for unsigned

I'm hesitant to get into a pattern where each supported type has its own file (e.g., int8.carbon, int64.carbon, int128.carbon, double.carbon, even the float.carbon I just mentioned; is there also char.carbon, etc?). If your renaming, perhaps filenames should be closer to categories of behavior, rather than individual types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've renamed these to arithmetic_mapped and arithmetic_bridged, assuming we want a single test file that includes i32 and i64 and a different test file that includes the other arithmetic types, which require thunks.
Null pointers, which are fundamental but not arithmetic, can probably have their own test file.
We'll probably need to take out pointer and reference type tests out of these test files eventually, as they test quite a different use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

"Arithmetic" alone would mean +-*/; how about numbers or arithmetic_types? cppreference says arithmetic types, which gives weight to that option.

Also, why is float still separate in return.carbon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, makes sense.
Done.

@bricknerb bricknerb requested a review from jonmeow July 11, 2025 13:37
@bricknerb bricknerb enabled auto-merge July 16, 2025 12:45
@bricknerb bricknerb added this pull request to the merge queue Jul 16, 2025
Merged via the queue into carbon-language:trunk with commit dd76c9b Jul 16, 2025
9 checks passed
@bricknerb bricknerb deleted the tests branch July 16, 2025 13:03
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.

3 participants