skiptools / skip

Skip transpiler for creating SwiftUI apps for iOS and Android

Home Page:https://skip.tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A string with a single interpolation is not inferred as ExpressibleByStringInterpolation

marcprux opened this issue · comments

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"}"))

Fixed by @aabewhite in 0.7.32 (0c2aa6b)