0

For the following multi-line string:

    jsContext.evaluateScript(
            """
            var console = {
                log: function(data) { __swift_log(data); }
            };
            """)

A compilation error is reported:

error: repl.swift:37:9: error: insufficient indentation of next 2 lines in multi-line string literal
        log: function(data) { __swift_log(data); }
        ^

repl.swift:39:9: note: should match space here
                """)
        ^

repl.swift:37:9: note: change indentation of these lines to match closing delimiter
        log: function(data) { __swift_log(data); }

I tried all sorts of things the only one that works is having the whole thing flush !!

"""
var console = {
log: function(data) { __swift_log(data); }
};
""")

enter image description here

That is an undesirable way to embed a heredoc / multi-line string. Is there an alternative?

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • 1
    I can't replicate this in Xcode nor at the swift repl command line. Can you provide a complete test case? – Rudedog May 18 '20 at 21:57
  • I am running this in the `repl` on 5.2.2. What are you looking for wrt `test case` - given `xcode` projects are a pretty big deal to put together? – WestCoastProjects May 18 '20 at 22:13

0 Answers0