Skip to content

Conversation

@alexoltean61
Copy link

This PR adds basic support for string literals, implementing #264. Each string literal is desugared to the application of a new function, which stores chunks in memory and returns their starting pointer.

In the test cases, I used this to define high-level revert and assert functions similar to regular Solidity.

Please note that string literals in pattern matching equations are still not supported. For example, this code snippet will not compile (but it does not compile on the main branch either):

import dispatch;

contract Match {
    function matchStr() -> () {
        match "test" {
            | "test" => return ();
            | _ => return ();
        }
    }
}

@alexoltean61 alexoltean61 mentioned this pull request Dec 22, 2025
mbenke and others added 3 commits December 22, 2025 19:25
Note that the match compiler needs revert built into Core (i.e. __revert__),
since it may revert with a message. Using a high-level revert function
would introduce a dependency between the compiler and the std library.

Co-authored-by: Alex Oltean <aoltean@mailbox.org>
@alexoltean61 alexoltean61 force-pushed the alexoltean61/string-literals branch from 0e5955a to ecb4574 Compare December 22, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants