mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
28 lines
357 B
Swift
28 lines
357 B
Swift
precedencegroup AssignmentPrecedence { assignment: true }
|
|
|
|
public enum Optional<T> {
|
|
case none
|
|
case some(T)
|
|
}
|
|
|
|
public struct B {
|
|
public func amIConfused() {}
|
|
}
|
|
|
|
public struct A {
|
|
public var b : B
|
|
|
|
public init() {
|
|
b = B()
|
|
}
|
|
|
|
public func isBConfused() {
|
|
b.amIConfused()
|
|
}
|
|
}
|
|
|
|
public func doSomething() -> A {
|
|
var a = A()
|
|
return a
|
|
}
|