diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 00c486a3add7671a9d0be5479589f06fa51774f0..13613287789ca2a425db4b40e6e52c987688583a 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1110,12 +1110,16 @@ private:
   /// and other tokens that we treat like binary operators.
   int getCurrentPrecedence() {
     if (Current) {
+      const FormatToken *NextNonComment = Current->getNextNonComment();
       if (Current->Type == TT_ConditionalExpr)
         return prec::Conditional;
+      else if (NextNonComment && NextNonComment->is(tok::colon) &&
+               NextNonComment->Type == TT_DictLiteral)
+        return prec::Comma;
       else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
                Current->Type == TT_SelectorName ||
-               (Current->is(tok::comment) && Current->getNextNonComment() &&
-                Current->getNextNonComment()->Type == TT_SelectorName))
+               (Current->is(tok::comment) && NextNonComment &&
+                NextNonComment->Type == TT_SelectorName))
         return 0;
       else if (Current->Type == TT_RangeBasedForLoopColon)
         return prec::Comma;
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index fcddba72a8b1a942fb82b5eea5c62d2491b7d04f..55e7cc6fe195039459224296e6dbe75f3ee90fd9 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/unittests/Format/FormatTestJS.cpp
@@ -123,6 +123,11 @@ TEST_F(FormatTestJS, ContainerLiterals) {
                "  // comment for tasks\n"
                "  tasks: false\n"
                "};");
+  verifyFormat("return {\n"
+               "  'finish':\n"
+               "      //\n"
+               "      a\n"
+               "};");
 }
 
 TEST_F(FormatTestJS, SpacesInContainerLiterals) {