<div dir="ltr"><div class="gmail_signature"><div class="gmail_signature">func perhapsConfusing() {</div><div class="gmail_signature">    let s =</div><div class="gmail_signature">    &quot;Since this function compiles fine. One might &quot;</div><div class="gmail_signature">    &quot;think that string literals in Swift can be &quot;</div><div class="gmail_signature">    &quot;written like this. But that is not the case. &quot;</div><div class="gmail_signature">    &quot;Only the first string literal will be printed.&quot;</div><div class="gmail_signature">    &quot;The rest (including eg this) will be silently &quot;</div><div class="gmail_signature">    &quot;ignored.&quot;</div><div class="gmail_signature">    12.34 // As will this.</div><div class="gmail_signature">    12 + 4 // And this.</div><div class="gmail_signature">    123 == 456 // And this.</div><div class="gmail_signature">    print(s) // Prints: &quot;Since this function compiles fine. One might &quot;</div><div class="gmail_signature">}</div><div class="gmail_signature"><br></div><div>Besides being possibly surprising for newcomers (who may assume string literals split across several lines as above will be joined), there are some related inconsistencies in whether warnings are generated for unused results or not, for example</div><div>123 == 456 // Unused result is silently ignored, while</div><div>1.2 == 3.4 // produces a warning: Result of call to &#39;==&#39; is unused.</div><div>(The following bug report is about unused results, but it doesn&#39;t mention the IMHO similar unused-literals-case: <a href="https://bugs.swift.org/browse/SR-245">https://bugs.swift.org/browse/SR-245</a> )</div><div><br></div><div>So my question is:</div><div>Should/could there be a warning for unused literals?</div><div><br></div><div>/Jens</div><div><br></div></div>
</div>