Skip to content

Commit d0d2ece

Browse files
committed
1 parent 9e14a73 commit d0d2ece

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

swift-mode-indent.el

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ It is a Generic parameter list if:
16521652
"consume" "copy" "discard"
16531653
"in"
16541654
"init" "deinit" "get" "set" "willSet" "didSet" "subscript"
1655-
"for" "case" "default" "while" "let" "var" "repeat" "if" "else"
1655+
"for" "case" "default" "while" "var" "repeat" "if" "else"
16561656
"guard" "break" "continue" "fallthrough" "return" "throw" "defer"
16571657
"do" "catch" "import" "typealias" "associatedtype"))
16581658

@@ -1672,8 +1672,7 @@ UNMATCHING-BRACKET-TEXT is a text of the current bracket."
16721672
(cond
16731673
((or (memq (swift-mode:token:type next-token) prohibited-tokens)
16741674
(member (swift-mode:token:text next-token) prohibited-tokens)
1675-
(string-match-p "^[\"$0-9]"
1676-
(swift-mode:token:text next-token)))
1675+
(string-match-p "^[\"$]" (swift-mode:token:text next-token)))
16771676
;; Not a generic parameter list. Returns to the initial position and
16781677
;; stops the loop.
16791678
(goto-char pos)

test/swift-files/indent/types.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,32 @@ let foo: protocol<
299299
B
300300
>
301301
= a
302+
303+
// Integer generic parameters
304+
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0452-integer-generic-parameters.md
305+
306+
struct Foo<
307+
let
308+
x
309+
:
310+
Int,
311+
let
312+
y
313+
:
314+
Int
315+
> {
316+
func foo() {
317+
}
318+
}
319+
320+
extension Foo
321+
where x == y {
322+
func bar() {
323+
}
324+
}
325+
326+
let x: Foo<1, 2>
327+
= Foo<1, 2>()
328+
329+
let x: Foo<-1, -2>
330+
= Foo<-1, -2>() // swift-mode:test:known-bug

0 commit comments

Comments
 (0)