-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Check for existing type before removing whitespaces #19087
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! (Still an issue with the new test to be fixed)
Test Results 19 files 19 suites 3d 16h 57m 47s ⏱️ For more details on these failures, see this check. Results for commit 17ceb67. ♻️ This comment has been updated with latest results. |
a489091
to
4042668
Compare
This fixes root-project#19022 In `TClassEdit::GetNormalizedName`, the call to `gInterpreterHelper->ExistingTypeCheck` is the one where eventually any alternative names for the class name being looked for will be detected and used for replacement (in `TClassTable::Check`). The alternative names for a custom class may appear in a dictionary when the user declared their class in the `ROOT::Meta::Selection` namespace and made it derive from the `KeepFirstTemplateArguments` type trait. Previously, the call to `ExistingTypeCheck` only happened after the input demangled type name passed through the normalization logic of `TClassEdit::TSplitType`. This led to an unfortunate situation. The demangled type name resulting from a previous `TClassEdit::DemangleName` call is the name representation of the typeid of the class type for the current execution, i.e. whatever was generate by the compiler. In the case of a class with multiple template arguments, this usually leads to a representation of the form `A<B, C>`, i.e. where the two template arguments are separated by a whitespace after the comma. Crucially, this representation is also the same one used by the type system to populate the dictionary information relative to the alternative class name for classes where the user wants to strip one or more template arguments. In the example just made, the class alternative name for `A<B>` will be registered as `A<B, C>` with the whitespace in the dictionary sources. Since the call to `ExistingTypeCheck` was happening *after* the `TSplitType` normalization, the input class name was lacking the extra whitespace. Thus, any search in `TClassTable::Check` would fail because it does a hash-based lookup of the string in the map of class alternatives. Thus, this commit introduces a second call to `ExistingTypeCheck` earlier on in the function, before the removal of the whitespace. This ensures that the name lookup in the type system can work correctly. Co-authored-by: Philippe Canal <pcanal@fnal.gov>
Fixes #19022
See first commit description for an explanation.
Third commit provides a reproducer of the linked issue, removing the first commit will produce the same exception from RField