Skip to content

Conversation

@MrGVSV
Copy link
Member

@MrGVSV MrGVSV commented Aug 8, 2024

Objective

As pointed out by @SkiFire13 on Discord, I was incorrect in #14641 regarding the type name of anonymous functions. I had stated that they will return something like fn(i32, i32) -> i32, but this is wrong. They actually behave like closures (despite not technically being closures) and return something more like foo::bar::{{closure}}.

This isn't a major issue because the reasoning behind #14641 still stands. However, the internal documentation should probably be updated so future contributors don't believe the lies I left behind.

Solution

Updated the internal documentation for create_info to reflect the actual type name of an anonymous function.

In that same module, I also added a test for function pointers and updated all tests to include sanity checks for the std::any::type_name of each category of callable.

Testing

You can test locally by running:

cargo test --package bevy_reflect

@MrGVSV MrGVSV added D-Trivial Nice and easy! A great choice to get started with Bevy A-Reflection Runtime information about types C-Testing A change that impacts how we test Bevy or how users test their apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 8, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 8, 2024
Add sanity checks to tests and add test for function pointers
@MrGVSV MrGVSV force-pushed the mrgvsv/reflect/anon-func-info-doc branch from 167ae96 to f6303ec Compare August 8, 2024 20:52
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 8, 2024
Merged via the queue into bevyengine:main with commit aeef1c0 Aug 8, 2024
@MrGVSV MrGVSV deleted the mrgvsv/reflect/anon-func-info-doc branch November 3, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Reflection Runtime information about types C-Testing A change that impacts how we test Bevy or how users test their apps D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants