Skip to content
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

(stdlib) Support ASCII-to-UTF8 string reassignment in compiled mode #466

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

perlun
Copy link
Collaborator

@perlun perlun commented Apr 27, 2024

No description provided.

@perlun perlun added stdlib Things related to the Perlang API/stdlib experimental compilation Issues which are relevant when using experimental compilation labels Apr 27, 2024
@perlun perlun force-pushed the feature/support-string-reassignment branch from 0dcea42 to 03531da Compare April 27, 2024 06:04
@@ -132,7 +132,7 @@ public void division_by_zero_throws_expected_runtime_error()
[SkippableFact]
public void division_by_zero_halts_execution()
{
Skip.If(PerlangMode.ExperimentalCompilation, "Not supported in compiled mode");
Skip.If(PerlangMode.ExperimentalCompilation, "Division by zero has undefined behavior in compiled mode.");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(Just a drive-by-improvement to make the skip message a bit clearer. We should try to do similarly on all skipped tests, ideally (or better yet, fix them so they are no longer skipped))

// not be reassigned on the second line... because it is constant. We'll have to think through how to solve this
// properly.
Skip.If(PerlangMode.ExperimentalCompilation, "Not yet supported in compiled mode");

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

☝️ This is the only test that didn't work in this test class. The other ones were just a matter of removing the skipping; they would already pass with our current code base.

@perlun perlun force-pushed the feature/support-string-reassignment branch from 03531da to 1be792f Compare April 27, 2024 06:13
output.Should()
.Be("this is a string");
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added for the sake of completeness. ASCIIString was already doing the right thing, since its from_static_string() was returned a std::shared_ptr<const ASCIIString> return value.


#include "utf8_string.h"

namespace perlang
{
UTF8String UTF8String::from_static_string(const char* s)
std::shared_ptr<const UTF8String> UTF8String::from_static_string(const char* s)
Copy link
Collaborator Author

@perlun perlun Apr 27, 2024

Choose a reason for hiding this comment

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

☝️ This is the fix that makes the test work.

@perlun perlun enabled auto-merge (squash) April 27, 2024 06:15
@perlun perlun merged commit e85afaf into master Apr 27, 2024
11 checks passed
@perlun perlun deleted the feature/support-string-reassignment branch April 27, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental compilation Issues which are relevant when using experimental compilation stdlib Things related to the Perlang API/stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant