Skip to content

Commit 3f1840c

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 53c6ec8 + ada9d92 commit 3f1840c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/IDE/SyntaxModel.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ SyntaxModelContext::SyntaxModelContext(SourceFile &SrcFile)
6767
Optional<unsigned> Length;
6868
if (AttrLoc.isValid()) {
6969
// This token is following @, see if it's a known attribute name.
70+
// Type attribute, decl attribute, or '@unknown' for swift case statement.
7071
if (TypeAttributes::getAttrKindFromString(Tok.getText()) != TAK_Count ||
71-
DeclAttribute::getAttrKindFromString(Tok.getText()) != DAK_Count) {
72+
DeclAttribute::getAttrKindFromString(Tok.getText()) != DAK_Count ||
73+
Tok.getText() == "unknown") {
7274
// It's a known attribute, so treat it as a syntactic attribute node for
7375
// syntax coloring. If swift gets user attributes then all identifiers
7476
// will be treated as syntactic attribute nodes.

test/IDE/coloring.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ func keywordInCaseAndLocalArgLabel(_ for: Int, for in: Int, class _: Int) {
377377
case (let x, let y):
378378
// CHECK: <kw>case</kw> (<kw>let</kw> x, <kw>let</kw> y):
379379
print(x, y)
380+
@unknown default:
381+
// CHECK: <attr-id>@unknown</attr-id> <kw>default</kw>:
382+
()
380383
}
381384
}
382385

0 commit comments

Comments
 (0)