branch: elpa/swift-mode
commit d0d2ece48570d824946b406b663eeb57dbffee3b
Author: taku0 <mxxouy6x3m_git...@tatapa.org>
Commit: taku0 <mxxouy6x3m_git...@tatapa.org>

    Support integer generic parameters
    
    
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0452-integer-generic-parameters.md
---
 swift-mode-indent.el                |  5 ++---
 test/swift-files/indent/types.swift | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/swift-mode-indent.el b/swift-mode-indent.el
index c646f874dc..fb6917270d 100644
--- a/swift-mode-indent.el
+++ b/swift-mode-indent.el
@@ -1652,7 +1652,7 @@ It is a Generic parameter list if:
     "consume" "copy" "discard"
     "in"
     "init" "deinit" "get" "set" "willSet" "didSet" "subscript"
-    "for" "case" "default" "while" "let" "var" "repeat" "if" "else"
+    "for" "case" "default" "while" "var" "repeat" "if" "else"
     "guard" "break" "continue" "fallthrough" "return" "throw" "defer"
     "do" "catch" "import" "typealias" "associatedtype"))
 
@@ -1672,8 +1672,7 @@ UNMATCHING-BRACKET-TEXT is a text of the current bracket."
         (cond
          ((or (memq (swift-mode:token:type next-token) prohibited-tokens)
               (member (swift-mode:token:text next-token) prohibited-tokens)
-              (string-match-p "^[\"$0-9]"
-                              (swift-mode:token:text next-token)))
+              (string-match-p "^[\"$]" (swift-mode:token:text next-token)))
           ;; Not a generic parameter list. Returns to the initial position and
           ;; stops the loop.
           (goto-char pos)
diff --git a/test/swift-files/indent/types.swift 
b/test/swift-files/indent/types.swift
index 31c45b71a9..ead20e24e8 100644
--- a/test/swift-files/indent/types.swift
+++ b/test/swift-files/indent/types.swift
@@ -299,3 +299,32 @@ let foo: protocol<
   B
 >
   = a
+
+// Integer generic parameters
+// 
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0452-integer-generic-parameters.md
+
+struct Foo<
+  let
+    x
+    :
+    Int,
+  let
+    y
+    :
+    Int
+> {
+    func foo() {
+    }
+}
+
+extension Foo
+  where x == y {
+    func bar() {
+    }
+}
+
+let x: Foo<1, 2>
+  = Foo<1, 2>()
+
+let x: Foo<-1, -2>
+  = Foo<-1, -2>() // swift-mode:test:known-bug

Reply via email to