<table><tr><td style="">aaronpuchert added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15694">View Revision</a></tr></table><br /><div><div><p>After testing the GitHub provider and the QmlJS code completion I'm somewhat confident that these changes are correct, but I want to give the experts on that code a chance to weigh in before I merge this. Now onto the discussion.</p>

<blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D15694#330761" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D15694#330761</a>, <a href="https://phabricator.kde.org/p/rjvbb/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@rjvbb</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>It's a shortist word that's easily recognisable that serves as a closing tag. Remove it, and my first impression will be that there's a fallthrough (because I'm not that used to returns in a switch). And a default: without break feels ... incomplete, makes me wonder if I missed a brace.</p></div>
</blockquote>

<p>As discussed earlier, switch statements do have a weird syntax and I'm completely with you if you don't like it. They are basically a glorified <tt style="background: #ebebeb; font-size: 13px;">goto</tt> cascade. The case labels actually behave like <tt style="background: #ebebeb; font-size: 13px;">goto</tt> labels in a lot of ways, which is the basis of oddities like <a href="https://en.wikipedia.org/wiki/Duff's_device" class="remarkup-link" target="_blank" rel="noreferrer">Duff's device</a> (which is a horrible idea, but it illustrates what switch statements can do). The normal way to exit a switch statement is obviously <tt style="background: #ebebeb; font-size: 13px;">break</tt>, but another terminator does just fine as well, depending on what you want to do. It might take some time to get used to it, but I don't think it's crazy.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>When case labels follow directly after others, no annotation is necessary.</p></blockquote>

<p>I don't disagree, but it *is* an exception that you can easily extend to other cases where it's evident that a fallthrough is intended:</p></blockquote>

<p>Like <a href="https://phabricator.kde.org/p/kossebau/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@kossebau</a>, I'm not sure these obvious cases occur so often in practice. In the two cases here where I had to figure whether the fallthrough was intended, it took me quite some time, and in one of them I think it actually wasn't intended. I don't think of it as an exception to allow multiple case labels directly after each other, but more of a way to handle multiple cases in <em>exactly</em> the same way. Note that you can freely reorder the case labels of such a block. It's just grouping cases together.</p>

<p>That isn't happening in your example, the cases are actually handled differently. One case, after some preprocessing, "falls through" to the second.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>After all that mumbling in my beard (because that's what it is really) I wouldn't be doing that so much if we were encouraged (or obliged) to use braces systematically:</p></blockquote>

<p>If we got to redesign C from scratch, I would probably agree. But it's probably a bit too invasive for existing code bases, compared to adding a few annotations. That is the fine line compiler writers want to walk on, making switch statements behave more sanely while at the same time not completely changing everything about the language.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15694">https://phabricator.kde.org/D15694</a></div></div><br /><div><strong>To: </strong>aaronpuchert, KDevelop<br /><strong>Cc: </strong>rjvbb, brauch, mssola, kossebau, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>