Skip to content

Conversation

tlively
Copy link
Member

@tlively tlively commented Feb 6, 2024

Update identifiers used in tests to use a format supported by the new text
parser, i.e. either the standard format with its limited set of allowed
characters or the non-standard $"..." format. Notably, any name containing
square or curly braces now uses the string format.

Input automatically updated with this script:
https://gist.github.com/tlively/4e22311736661849e641d02e521a0748

The printer is updated to properly escape names in more places as well. The
logic for escaping names is moved to a common location so that the type
printing logic in wasm-type.cpp can use it as well.

@tlively
Copy link
Member Author

tlively commented Feb 6, 2024

;; CHECK: (type $0 (func))

;; CHECK: (type $[i8] (array i8))
(type $[i8] (array i8))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moved away because the names no longer match, I guess? Should we update both at once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, and it looks like the follow-up hasn't fixed it fully. Updating both at once makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kripken PTAL. The commits on this PR should be separately reviewable, but we can land them all together to avoid intermediate test regressions.

@tlively tlively changed the title [NFC] Update identifiers in test inputs Properly escape names in tests Feb 6, 2024
@tlively tlively changed the title Properly escape names in tests Properly stringify names in tests Feb 6, 2024
}
}
return os << '"';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, the changes here and in name.h are not performance-sensitive (printing text isn't) and so they could be in the .cpp files instead, for faster compile times.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add a new .cpp files for these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github thinks this is a binary file... any idea why that is?

It doesn't seem to have thought it was binary before: https://github.com/WebAssembly/binaryen/blob/main/test/spec/comments.wast

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe my update script broke some unicode in this file. I'll revert it.

@@ -1,5 +1,5 @@
(module
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $$i32_i32_=>_i32 (func (param i32 i32) (result i32)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this happen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure. Reverted it locally and re-updated the tests and it never came back.

@tlively tlively requested a review from kripken February 6, 2024 20:22
@tlively
Copy link
Member Author

tlively commented Feb 6, 2024

Merge activity

  • Feb 6, 4:06 PM EST: @tlively started a stack merge that includes this pull request via Graphite.
  • Feb 6, 4:36 PM EST: Graphite rebased this pull request as part of a merge.
  • Feb 6, 5:05 PM EST: @tlively merged this pull request with Graphite.
@tlively tlively force-pushed the parser-string-names branch from 77ff8b6 to 00a5702 Compare February 6, 2024 21:06
Base automatically changed from parser-string-names to main February 6, 2024 21:35
Update identifiers used in tests to use a format supported by the new text parser, i.e. either the standard format with its limited set of allowed characters or the non-standard `$"..."` format. Notably, any name containing square or curly braces now uses the string format. Input automatically updated with this script: https://gist.github.com/tlively/4e22311736661849e641d02e521a0748 Some test output that the script updates is reverted by the test updater script because the printer does not escape all the names it should. This will be addressed in a follow-up PR.
There were a few places in Print.cpp where we were printing names directly (e.g. `o << '$' << name`) without proper escaping. Fix those places and update the test output.
The next commit will use the newly shared name printing logic to correctly escape type names when printing types.
@tlively tlively merged commit 3a41065 into main Feb 6, 2024
@tlively tlively deleted the test-input-names branch February 6, 2024 22:05
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Update identifiers used in tests to use a format supported by the new text parser, i.e. either the standard format with its limited set of allowed characters or the non-standard `$"..."` format. Notably, any name containing square or curly braces now uses the string format. Input automatically updated with this script: https://gist.github.com/tlively/4e22311736661849e641d02e521a0748 The printer is updated to properly escape names in more places as well. The logic for escaping names is moved to a common location so that the type printing logic in wasm-type.cpp can use it as well.
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants