Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Generate proper default string value for JavaScript #5239

Merged
merged 7 commits into from
Mar 23, 2024

Conversation

RustanLeino
Copy link
Collaborator

Fixes #5238

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@RustanLeino RustanLeino marked this pull request as ready for review March 22, 2024 00:14
@@ -974,7 +974,7 @@ protected class ClassWriter : IClassWriter {
return $"{DafnyMultiSetClass}.Empty";
} else if (xType is SeqType seq) {
if (seq.Arg.IsCharType) {
return "''";
return "_dafny.Seq.UnicodeFromString('')";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this still support --unicode-char=false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call. The answer happens to be "yes", and I really mean "happens to". I changed the code to treat the two cases separately.
In writing more test cases, I also ran across the known non-uniformity with the printing of empty strings in Python. I was able to remove this non-uniformity for the default string.

@RustanLeino RustanLeino merged commit f4fa255 into dafny-lang:master Mar 23, 2024
20 checks passed
@RustanLeino RustanLeino deleted the issue-5238 branch March 23, 2024 02:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default JavaScript value for string malformed
3 participants