Files
swift-mirror/test/Serialization/operator.swift
Jordan Rose 929d86bb16 [serialization] Add support for prefix and postfix operators.
This includes adding an operator lookup table to ModuleFile. Operators are
keyed by a (name, fixity) pair.

Swift SVN r6078
2013-07-08 23:41:06 +00:00

25 lines
573 B
Swift

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %swift -emit-module -o %t/def_operator.swiftmodule %S/Inputs/def_operator.swift
// RUN: llvm-bcanalyzer %t/def_operator.swiftmodule | FileCheck %s
// RUN: %swift -i -I=%t %s | FileCheck --check-prefix=OUTPUT %s
// CHECK-NOT: FALL_BACK_TO_TRANSLATION_UNIT
import def_operator
func [prefix] ~~~(x : Int) -> (Int, Int, Int) {
return (x, x, x)
}
var triple = (~~~42)
println("(\(triple.0), \(triple.1), \(triple.2))")
// OUTPUT: (42, 42, 42)
func [postfix] ^^(x : Int) -> Int {
return x ^ x
}
println("\(1^^)")
// OUTPUT: 0