Desugar template type alias specialisations in wrapper return types#997
Open
guitargeek wants to merge 1 commit into
Open
Desugar template type alias specialisations in wrapper return types#997guitargeek wants to merge 1 commit into
guitargeek wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #997 +/- ##
==========================================
+ Coverage 82.78% 82.79% +0.01%
==========================================
Files 15 15
Lines 5048 5052 +4
==========================================
+ Hits 4179 4183 +4
Misses 869 869
🚀 New features to boost your workflow:
|
When generating a JitCall wrapper for a function whose return type is a template type alias specialisation -- e.g. `std::enable_if_t<is_constructible_v<...>, std::any>` as on `std::make_any` -- get_type_as_string left the alias sugared. The printer's FullyQualifiedName policy applies to types but does not propagate into expression-level non-type template arguments, so identifiers like `is_constructible_v` were emitted without their `std::` qualifier and the wrapper failed to compile with `use of undeclared identifier`. Strip TemplateSpecializationType sugar where isTypeAlias() is true before printing. The desugared form is the alias body with explicit arguments substituted (here, std::any), which compiles cleanly. Regular typedefs (std::string and friends) are not TemplateSpecializationType sugar and keep their preferred name. Reported as cppyy issue compiler-research/cppyy#218; reproducer is `cppyy.gbl.std.make_any["MyClass*", "MyClass*"](my_inst)` after `cppyy.include("any")`. Adds a regression test that instantiates std::make_any<MyClass*, MyClass*> and asserts MakeFunctionCallable returns a kGenericCall JitCall.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When generating a JitCall wrapper for a function whose return type is a template type alias specialisation -- e.g.
std::enable_if_t<is_constructible_v<...>, std::any>as onstd::make_any-- get_type_as_string left the alias sugared. The printer's FullyQualifiedName policy applies to types but does not propagate into expression-level non-type template arguments, so identifiers likeis_constructible_vwere emitted without theirstd::qualifier and the wrapper failed to compile withuse of undeclared identifier.Strip TemplateSpecializationType sugar where isTypeAlias() is true before printing. The desugared form is the alias body with explicit arguments substituted (here, std::any), which compiles cleanly. Regular typedefs (std::string and friends) are not TemplateSpecializationType sugar and keep their preferred name.
Reported as cppyy issue
compiler-research/cppyy#218; reproducer is
cppyy.gbl.std.make_any["MyClass*", "MyClass*"](my_inst)aftercppyy.include("any"). Adds a regression test that instantiates std::make_any<MyClass*, MyClass*> and asserts MakeFunctionCallable returns a kGenericCall JitCall.Description
Please include a summary of changes, motivation and context for this PR.
Fixes # (issue)
Type of change
Please tick all options which are relevant.
Testing
Please describe the test(s) that you added and ran to verify your changes.
Checklist