Files
swift-mirror/test/Serialization/Inputs/struct_with_operators.swift
Jordan Rose 531b240ca0 [serialization] Rework cross-references to be more general / more robust.
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
2013-12-17 23:03:34 +00:00

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")
}