-
-
Notifications
You must be signed in to change notification settings - Fork 18
fix: Fix pointer value assignment type conversion #1526
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
Conversation
pkg.pr.new packages
benchmark commit |
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.
Great! 🪄
? lhsExpr.dataType.type === 'ptr' | ||
? [lhsExpr.dataType.inner as AnyData] | ||
: [lhsExpr.dataType as AnyData] | ||
: undefined; |
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.
This was actually a significant bug that completely disabled the type conversion for logical and binary expressions.
const forcedType = expression[0] === NODE.assignmentExpr
? [lhsExpr.dataType as AnyData]
: [];
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.
Passing an empty array to convertToCommonType
as the forcedType
parameter says that the converted types have to be one of the ones in the array - since it was empty conversions were disabled.
Co-authored-by: Iwo Plaza <[email protected]>
Should we add a warning (or maybe throw even)? console.warn(
'convertToCommonType was called with an empty restrictTo array, which prevents any conversions from being matched. If you want to allow all conversions, pass undefined instead. If this is intentional, consider calling the function conditionally, as the result will always be undefined.',
); We could also make an empty array act the same way as undefined since calling this function with no legal conversions makes little sense. |
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.
Yes please!
apps/typegpu-docs/src/content/examples/simulation/fluid-with-atomics/index.ts
Outdated
Show resolved
Hide resolved
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.
Awesome blossom! EXTRA AWESOME 🌸
Previously we always made the type conversion system pick the lhs type regardless of all rules which resulted in trying to create a reference for the rhs instead of dereferencing lhs.
Before:
After:
(I also removed the redundant whitespace before the newline in the resolution error, it was driving me crazy. My formatter kept stubbornly removing trailing whitespace in inline snapshots.)