-
-
Notifications
You must be signed in to change notification settings - Fork 180
Fix handling generic type in several IL #3172
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
Open
josesimoes
wants to merge
11
commits into
nanoframework:develop
Choose a base branch
from
Eclo:fix-IL-generics
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1c96e58
Fix handling generic type in several IL
josesimoes 39ad36f
Add safety on generic param count
josesimoes 895c97d
Improve size computation for array objects
josesimoes ae5b1fb
Fix walking generic params in signatures
josesimoes 9d3eeb5
Remove duplicated TypeDescriptorsMatch implementation
josesimoes 7d7ab26
Add check for calls to CLR_RT_SignatureParser
josesimoes c58ac3e
Add sanity check for null callers or types
josesimoes d137dd2
Improve the previous fix to use the common pattern
josesimoes c0bcc04
Improve comments and add sanity check
josesimoes 411613f
Code style fixes (#158)
nfbot 8f5db09
Fix parameter signess
josesimoes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Potential recursive call issue in array element type comparison.
This line appears to be making a recursive call to
TypeDescriptorsMatch
with the same parameters, which could lead to infinite recursion. For array element type comparison, you typically need to compare the element types, not the array types again.Consider modifying to compare element types instead:
📝 Committable suggestion
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.
There is no GetElementType() API in CLR_RT_TypeDescriptor .
I believe this is OK as it is... if you don't have a better suggestion let's leave it as it is.
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.
@josesimoes Thank you for clarifying that there's no GetElementType() API available. You're right that my suggestion wouldn't work without that API.
However, I still want to caution about the current implementation, as it calls itself recursively with the same parameters:
return TypeDescriptorsMatch(expectedType, actualType);
This could potentially lead to infinite recursion if both types are arrays. If you're confident this won't be an issue in your implementation (perhaps because of other constraints that prevent this case), then it's reasonable to leave as is.
Alternatively, you might consider adding explicit element type extraction logic in this case block if needed for correctness.
✏️ Learnings added