-
Notifications
You must be signed in to change notification settings - Fork 760
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
[Strings] Make string a subtype of ext, not any #7373
base: main
Are you sure you want to change the base?
Conversation
// Bottom types already handled (including string as the switch value, | ||
// which implies the other value is bottom, which again would have been | ||
// handled). |
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 don't understand the addition to this comment. string
isn't a bottom type, so why is it included in the bottom types already having been handled?
@@ -949,8 +956,9 @@ std::optional<HeapType> HeapType::getSuperType() const { | |||
case none: | |||
case exn: | |||
case noexn: | |||
case string: |
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.
Yikes! This doesn't look like it was correct before, since it should have returned any
. Do you know how this wasn't caught by tests?
(any.convert_extern | ||
(extern.convert_any | ||
(string.const "string") |
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.
It might still be useful to test any.convert_extern
of a string.
(ref.null noextern) ;; The change from stringref to externref does not | ||
;; cause problems here, nothing needs to change. |
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 this unlock any potential code simplifications in StringLowering.cpp?
StringLowering converts strings to externs, which makes sense as we lower
stringrefs to imported JS strings. For the reverse transform it is convenient
to just have strings be subtypes of ext, see #7370 - that makes it simple to
switch stringref to externref and vice versa.