Files
swift-mirror/test/SourceKit/CodeFormat/indent-basic.swift
John McCall c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00

45 lines
1.4 KiB
Swift

class Foo {
var test : Int
func foo() {
test = 1
}
}
func foo(a a: [Int: Int]) {}
foo(a: [
3: 3
])
precedencegroup Whatever {
x
}
// RUN: %sourcekitd-test -req=format -line=1 -length=1 %s >%t.response
// RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=6 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=7 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=13 -length=1 %s >>%t.response
// RUN: %sourcekitd-test -req=format -line=17 -length=1 %s >>%t.response
// RUN: FileCheck --strict-whitespace %s <%t.response
// CHECK: key.sourcetext: "class Foo {"
// CHECK: key.sourcetext: " "
// CHECK: key.sourcetext: " var test : Int"
// CHECK: key.sourcetext: " "
// CHECK: key.sourcetext: " func foo() {"
// CHECK: key.sourcetext: " test = 1"
// CHECK: key.sourcetext: " }"
// CHECK: key.sourcetext: " "
// CHECK: key.sourcetext: "}"
// "foo(a: ["
// CHECK: key.sourcetext: " 3: 3"
// CHECK: key.sourcetext: " x"