mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Previously, cross-references just carried a chain of identifiers and a top-level module, plus a type to validate against, a generic parameter index, or an operator fixity. However, referencing "the first generic parameter of the prefix function ++ that takes a ForwardIndex" requires /all three/ of these filters to unambiguously select the right declaration. Now, cross-references consist of a chain of trailing records, one for each link in the path. There are (currently) five kinds of links: Type: a declaration that cannot have overloads Value: a declaration that can have overloads (filtered by type) Extension: filter to decls within extensions on another module Operator: - as the first path piece, an operator declaration - as a later path piece, a fixity filter for operator functions Generic Param: an indexed generic parameter of the previous result This should allow us to uniquely cross-reference any Swift declaration we need to. Swift SVN r11399
16 lines
241 B
Swift
16 lines
241 B
Swift
struct SpecialInt {
|
|
var value = 0
|
|
}
|
|
|
|
operator prefix +++ {}
|
|
operator postfix +++ {}
|
|
|
|
@prefix func +++(base: @inout SpecialInt) {
|
|
base.value += 2
|
|
}
|
|
|
|
@postfix func +++(base: @inout SpecialInt) {
|
|
println("use the prefix form instead")
|
|
}
|
|
|