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

A string with a single interpolation is not inferred as ExpressibleByStringInterpolation #64

Closed
marcprux opened this issue Dec 10, 2023 · 1 comment

Comments

@marcprux
Copy link
Contributor

marcprux commented Dec 10, 2023

The string "A\(x)Z" can be used as an ExpressibleByStringInterpolation, but the string with just a single interpolation like "\(x)" cannot.

See the test case at skiptools/skip-lib@f1d42cf

Two adjacent string interpolations:

        XCTAssertEqual("stringstring", intepolate("\("string")\("string")"))

will be transpiled to the Kotlin:

        XCTAssertEqual("stringstring", intepolate({
            val str = StringExpressibleExample.StringInterpolationExample(literalCapacity = 0, interpolationCount = 0)
            str.appendInterpolation("string")
            str.appendInterpolation("string")
            StringExpressibleExample(stringInterpolation = str)
        }()))

But the single string interpolation:

        XCTAssertEqual("string", intepolate("\("string")"))

does not handle interpolation:

        XCTAssertEqual("string", intepolate("${"string"}"))
@marcprux
Copy link
Contributor Author

Fixed by @aabewhite in 0.7.32 (0c2aa6b)

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

No branches or pull requests

1 participant