-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: incorrect code generation for parameter borrowing #1460
fix: incorrect code generation for parameter borrowing #1460
Conversation
Querying whether and what kind of view a type represents has nothing to do with the "type allowed" checks.
Both `mirgen` and `isPassByRef` didn't consider non-direct views when deciding whether the parameter uses pass-by-reference. Now they do.
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.
One minor comment related suggestion, but not a blocker.
result = classifyViewTypeAux(marker, t) | ||
|
||
proc directViewType*(t: PType): ViewTypeKind = | ||
# does classify 't' without looking recursively into 't'. |
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.
# does classify 't' without looking recursively into 't'. | |
## classifies 't' without looking recursively into 't'. |
A tad clearer and shorter, also made it a doc comment as it's relevant to what to expect from the procedure.
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.
I agree, but I figured to not modify the moved-over code, so as to allow git tooling to better detect the moved code.
/merge |
Merge requested by: @saem Contents after the first section break of the PR description has been removed and preserved below: |
Summary
Fix parameters below the pass-by-reference size threshold not being
passed by reference when the procedure returns a non-direct view,
resulting in access violations at run-time when trying to access the
returned view.
Details
object
types withlent
fields) when deciding whether pass-by-reference is used for the first
parameter of a procedure
classifyViewType
procedures fromtypeallowed
totypes
,as they're wholly unrelated to the "type allowed" checks
Fixes #1457.