Files
swift-mirror/test/SIL/Parser/generic_signature_with_depth.swift
Doug Gregor 793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00

33 lines
1.5 KiB
Swift

// RUN: %target-swift-frontend %s -emit-silgen | %target-sil-opt -verify | FileCheck %s
protocol mmGeneratorType {
typealias Element
}
protocol mmSequenceType {
typealias Generator : mmGeneratorType
}
protocol mmCollectionType : mmSequenceType {
}
protocol mmExt : mmCollectionType {
mutating func extend<
S : mmSequenceType
where S.Generator.Element == Self.Generator.Element
> (seq: S)
}
// CHECK-LABEL: @_TF28generic_signature_with_depth4testUS_5mmExt_S0__US_15mmGeneratorType__S1___FTQ_Q0__Q_ : $@convention(thin) <EC1, EC2 where EC1 : mmExt, EC2 : mmExt, EC1.Generator : mmGeneratorType, EC2.Generator : mmGeneratorType, EC1.Generator.Element == EC2.Generator.Element> (@out EC1, @in EC1, @in EC2) -> () {
// CHECK: witness_method $EC1, #mmExt.extend!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : mmExt, τ_0_0.Generator : mmGeneratorType><τ_1_0 where τ_1_0 : mmSequenceType, τ_1_0.Generator : mmGeneratorType, τ_1_0.Generator.Element == τ_0_0.Generator.Element> (@in τ_1_0, @inout τ_0_0) -> ()
// CHECK: apply {{%[0-9]+}}<EC1, EC1.Generator, EC1.Generator.Element, EC2, EC2.Generator>(%7#1, %3#1) : $@convention(witness_method) <τ_0_0 where τ_0_0 : mmExt, τ_0_0.Generator : mmGeneratorType><τ_1_0 where τ_1_0 : mmSequenceType, τ_1_0.Generator : mmGeneratorType, τ_1_0.Generator.Element == τ_0_0.Generator.Element> (@in τ_1_0, @inout τ_0_0) -> ()
func test<
EC1 : mmExt,
EC2 : mmExt
where EC1.Generator.Element == EC2.Generator.Element
>
(var lhs: EC1, _ rhs: EC2) -> EC1 {
lhs.extend(rhs)
return lhs
}