Repository navigation
Tighten versionsuffix rules and add WAST tests - #738
lukewagner wants to merge 3 commits into
Conversation
chenyan2002
left a comment
There was a problem hiding this comment.
the grammar currently only allows a versionsuffix when the version in the name is "canonical"
I think this is implemented in bytecodealliance/wasm-tools#2693
| (assert_invalid | ||
| (component | ||
| (import "a:b/c@1" (versionsuffix ".2.3") (instance)) | ||
| (import "a:b/c@1" (versionsuffix ".2.3") (instance))) |
There was a problem hiding this comment.
During the transition period, there is this strange mixed use of canonical name and full version:
(import "a:b/c@1" (versionsuffix ".2.3") (instance))
(import "a:b/c@1.2.3" (instance))
I guess we don't need to say much in the spec, but in the implementation, we do need to take care of this, and report it as an error.
There was a problem hiding this comment.
Agreed, I didn't add anything to the spec for this since presumably this case goes away over time.
| the `versionsuffix` results in a `valid semver` as defined by | ||
| [https://semver.org](https://semver.org/). A `versionsuffix` is otherwise | ||
| ignored for validation except to improve diagnostic messages. | ||
| * 🔗 Validation requires that a `versionsuffix` is only present when the |
There was a problem hiding this comment.
s/is only/is/ perhaps? (to clarify it's always required for canonversion)
There was a problem hiding this comment.
The update refers to the "Canonical Interface Version" section which now says that the concatenation must split at the "right" point, as defined by the pseudo-algorithm in that section, so I think that will end up forcing a suffix when you have a canonversion (except when the canonversion is valid semver on its own).
07a62cc to
e3a6641
Compare
|
Thanks for the review! This commit updates the spec/tests to now cover the special pre-release rules (which required adding a new grammar case to With those changes and consequent WAST updates, Only last question: could we update |
|
|
Awesome, renamed in the last commit. |
This PR makes the change suggested in #735 of always requiring a valid semver string (when there is a version at all).
In adding some WAST tests for
versionsuffix, I noticed a few other variations from the spec andwasm-toolsas captured in this PR intest/validation/version-suffix.wast. In particular: the grammar currently only allows aversionsuffixwhen the version in the name is "canonical" (e.g.,a:b/c@1.2is not "canonical" so it shouldn't be allowed to have aversionsuffixaccording to the current grammar). Also, the current text parser only parses the attributes in a fixed order, whereas the grammar parses them in any order. Happy to hear arguments if yall think we should change the spec on either of these though.One last thing on the topic of
versionsuffix: we have since added the attributeexternal-id, which is hyphenated, so it seems like we should name the attributeversion-suffixinstead. Happy to make this change in this PR too.cc @chenyan2002 for thoughts on this too
(I'll be out for until next week, sorry in advance for slow reply.)