Fix subst_externtype matching on incorrect argument types#2120
Merged
rossberg merged 4 commits intoWebAssembly:mainfrom Mar 24, 2026
Merged
Fix subst_externtype matching on incorrect argument types#2120rossberg merged 4 commits intoWebAssembly:mainfrom
rossberg merged 4 commits intoWebAssembly:mainfrom
Conversation
Member
|
You'll need to sync wasm-latest. (Tip: |
Contributor
Author
|
My local |
rossberg
approved these changes
Mar 24, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The substitution function for
externtypeis incorrectly using the substitution fordeftypefor function externs instead of the intendedtypeuse, missing the other two cases oftypeuse(most importantlytypeidx).The reference interpreter is correct by using
subst_typeuse.The AL interpreter seems to be unaffected because iirc only
deftypes exist during actual runtime, andsubst_typeusesimply dispatches deftypes usingsubst_deftype, so this type error is hidden by implicit coercions (either in IL or elaboration), taking the substitution function as deliberately only defined on func externs that aredeftypes. Is there something we could do in any of the checks to produce a warning for this kind of scenario (which would have made it obvious)?For the other part of the tests, module validation should have been affected if generated from the spectec DSL, but that is out of the scope of AL as it focuses on generating the interpreter only and delegates validation etc to the reference interpreter, which is correct on this. Latex backend doesn't seem to print the full substitution definition either. As a result, the prose seems to be the only one that makes this change observable.
There also seems to be some test mismatches under
spectec/test-interpreter(I think this is the one for AL?), but those are pre-existing in the current main (probably after #2093 looking at the errors).