Skip to content

Make __consuming meaningful for code generation. #19613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3646,23 +3646,6 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
llvm_unreachable("Unhandled Representation in switch.");
}

bool hasGuaranteedSelfParam() const {
switch (getRepresentation()) {
case Representation::Thick:
case Representation::Block:
case Representation::Thin:
case Representation::CFunctionPointer:
case Representation::ObjCMethod:
case Representation::Closure:
return false;
case Representation::Method:
case Representation::WitnessMethod:
return true;
}

llvm_unreachable("Unhandled Representation in switch.");
}

/// True if the function representation carries context.
bool hasContext() const {
switch (getRepresentation()) {
Expand Down
29 changes: 22 additions & 7 deletions lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3179,12 +3179,12 @@ AnyFunctionType::Param swift::computeSelfParam(AbstractFunctionDecl *AFD,
return AnyFunctionType::Param(ErrorType::get(Ctx));

bool isStatic = false;
bool isMutating = false;
SelfAccessKind selfAccess = SelfAccessKind::NonMutating;
bool isDynamicSelf = false;

if (auto *FD = dyn_cast<FuncDecl>(AFD)) {
isStatic = FD->isStatic();
isMutating = FD->isMutating();
selfAccess = FD->getSelfAccessKind();

// Methods returning 'Self' have a dynamic 'self'.
//
Expand All @@ -3195,7 +3195,7 @@ AnyFunctionType::Param swift::computeSelfParam(AbstractFunctionDecl *AFD,
if (isInitializingCtor) {
// initializing constructors of value types always have an implicitly
// inout self.
isMutating = true;
selfAccess = SelfAccessKind::Mutating;
} else {
// allocating constructors have metatype 'self'.
isStatic = true;
Expand All @@ -3209,8 +3209,11 @@ AnyFunctionType::Param swift::computeSelfParam(AbstractFunctionDecl *AFD,
isDynamicSelf = true;
}
} else if (isa<DestructorDecl>(AFD)) {
// destructors of value types always have an implicitly inout self.
isMutating = true;
// Destructors only correctly appear on classes today. (If move-only types
// have destructors, they probably would want to consume self.)
// Note that we can't assert(containerTy->hasReferenceSemantics()) here
// since incorrect or incomplete code could have deinit decls in invalid
// contexts, and we need to recover gracefully in those cases.
}

if (isDynamicSelf)
Expand All @@ -3224,8 +3227,20 @@ AnyFunctionType::Param swift::computeSelfParam(AbstractFunctionDecl *AFD,
if (containerTy->hasReferenceSemantics())
return AnyFunctionType::Param(selfTy);

return AnyFunctionType::Param(selfTy, Identifier(),
ParameterTypeFlags().withInOut(isMutating));
auto flags = ParameterTypeFlags();
switch (selfAccess) {
case SelfAccessKind::__Consuming:
flags = flags.withOwned(true);
break;
case SelfAccessKind::Mutating:
flags = flags.withInOut(true);
break;
case SelfAccessKind::NonMutating:
// The default flagless state.
break;
}

return AnyFunctionType::Param(selfTy, Identifier(), flags);
}

void UnboundGenericType::Profile(llvm::FoldingSetNodeID &ID,
Expand Down
39 changes: 0 additions & 39 deletions lib/SIL/SILFunctionBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,6 @@ SILFunction *SILFunctionBuilder::getOrCreateFunction(
return fn;
}

static bool verifySILSelfParameterType(SILDeclRef DeclRef, SILFunction *F,
CanSILFunctionType FTy) {
SILModule &M = F->getModule();
SILParameterInfo PInfo = FTy->getSelfParameter();
CanType CTy = PInfo.getType();
SILType Ty = SILType::getPrimitiveObjectType(CTy);

// We do not care about trivial parameters (for now). There seem to be
// cases where we lower them as unowned.
//
// *NOTE* We do not run this check when we have a generic type since
// *generic types do not have type lowering and are always treated as
// *non-trivial since we do not know the type.
if (CTy->hasArchetype() || CTy->hasTypeParameter() ||
M.getTypeLowering(Ty).isTrivial())
return true;

// If this function is a constructor or destructor, bail. These have @owned
// parameters.
if (DeclRef.isConstructor() || DeclRef.isDestructor())
return true;

// Otherwise, if this function type has a guaranteed self parameter type,
// make sure that we have a +0 self param.
return !FTy->getExtInfo().hasGuaranteedSelfParam() || PInfo.isGuaranteed() ||
PInfo.isIndirectMutating();
}

static void addFunctionAttributes(SILFunction *F, DeclAttributes &Attrs,
SILModule &M) {
for (auto *A : Attrs.getAttributes<SemanticsAttr>())
Expand Down Expand Up @@ -151,17 +123,6 @@ SILFunctionBuilder::getOrCreateFunction(SILLocation loc, SILDeclRef constant,
addFunctionAttributes(F, decl->getAttrs(), mod);
}

// If this function has a self parameter, make sure that it has a +0 calling
// convention. This cannot be done for general function types, since
// function_ref's SILFunctionTypes do not have archetypes associated with
// it.
CanSILFunctionType FTy = F->getLoweredFunctionType();
if (FTy->hasSelfParam()) {
(void)&verifySILSelfParameterType;
assert(verifySILSelfParameterType(constant, F, FTy) &&
"Invalid signature for SIL Self parameter type");
}

return F;
}

Expand Down
7 changes: 2 additions & 5 deletions lib/SIL/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,8 @@ class DestructureInputs {
if (ownership == ValueOwnership::InOut) {
convention = ParameterConvention::Indirect_Inout;
} else if (isFormallyPassedIndirectly(origType, substType, substTL)) {
if (forSelf && rep == SILFunctionTypeRepresentation::WitnessMethod)
convention = ParameterConvention::Indirect_In_Guaranteed;
else
convention = Convs.getIndirect(ownership, forSelf, origParamIndex,
origType, substTL);
convention = Convs.getIndirect(ownership, forSelf, origParamIndex,
origType, substTL);
assert(isIndirectFormalParameter(convention));
} else if (substTL.isTrivial()) {
convention = ParameterConvention::Direct_Unowned;
Expand Down
5 changes: 3 additions & 2 deletions lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,9 @@ bool LifetimeChecker::diagnoseMethodCall(const DIMemoryUse &Use,
// the generic error that we would emit before.
//
// That is the only case where we support pattern matching a release.
if (Release && AI &&
!AI->getSubstCalleeType()->getExtInfo().hasGuaranteedSelfParam())
if (Release && AI /*
&& (!AI->getSubstCalleeType()->hasSelfParam()
|| !AI->getSubstCalleeType()->getSelfParameter().isGuaranteed())*/)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gottesmm Do you know what this hasGuaranteedSelfParam check was trying to accomplish? Removing doesn't appear to have any effect on the test suite, and this was the only remaining use of a broken SILFunctionType::hasGuaranteedSelfParam() method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just rip it out.

MI = nullptr;

if (AI && MI) {
Expand Down
11 changes: 11 additions & 0 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5753,6 +5753,17 @@ Expr *ExprRewriter::coerceCallArguments(
// If we came from a scalar, create a scalar-to-tuple conversion.
TupleShuffleExpr::TypeImpact typeImpact;
if (argTuple == nullptr) {
// Deal with a difference in only scalar ownership.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuck. Hopefully this all goes away one day.

if (auto paramParenTy = dyn_cast<ParenType>(paramType.getPointer())) {
assert(paramParenTy->getUnderlyingType()
->isEqual(cs.getType(arg)));
auto argParen = new (tc.Context) ParenExpr(arg->getStartLoc(),
arg, arg->getEndLoc(), false,
paramParenTy);
argParen->setImplicit();
return cs.cacheType(argParen);
}

typeImpact = TupleShuffleExpr::ScalarToTuple;
assert(isa<TupleType>(paramType.getPointer()));
} else if (isa<TupleType>(paramType.getPointer())) {
Expand Down
16 changes: 8 additions & 8 deletions test/SILGen/foreach.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func trivialStructBreak(_ xx: [Int]) {
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var IndexingIterator<Array<Int>> }, var, name "$x$generator"
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<Int>
// CHECK: store_borrow [[ARRAY]] to [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF
// CHECK: apply [[MAKE_ITERATOR_FUNC]]<[Int]>([[PROJECT_ITERATOR_BOX]], [[BORROWED_ARRAY_STACK]])
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
//
Expand Down Expand Up @@ -213,8 +213,8 @@ func existentialBreak(_ xx: [P]) {
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var IndexingIterator<Array<P>> }, var, name "$x$generator"
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<P>
// CHECK: store_borrow [[ARRAY]] to [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF
// CHECK: apply [[MAKE_ITERATOR_FUNC]]<[P]>([[PROJECT_ITERATOR_BOX]], [[BORROWED_ARRAY_STACK]])
// CHECK: [[ELT_STACK:%.*]] = alloc_stack $Optional<P>
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
Expand Down Expand Up @@ -376,8 +376,8 @@ func genericStructBreak<T>(_ xx: [GenericStruct<T>]) {
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box $<τ_0_0> { var IndexingIterator<Array<GenericStruct<τ_0_0>>> } <T>, var, name "$x$generator"
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<GenericStruct<T>>
// CHECK: store_borrow [[ARRAY]] to [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF
// CHECK: apply [[MAKE_ITERATOR_FUNC]]<[GenericStruct<T>]>([[PROJECT_ITERATOR_BOX]], [[BORROWED_ARRAY_STACK]])
// CHECK: [[ELT_STACK:%.*]] = alloc_stack $Optional<GenericStruct<T>>
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
Expand Down Expand Up @@ -486,8 +486,8 @@ func genericCollectionBreak<T : Collection>(_ xx: T) {
// CHECK: bb0([[COLLECTION:%.*]] : @trivial $*T):
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box $<τ_0_0 where τ_0_0 : Collection> { var τ_0_0.Iterator } <T>, var, name "$x$generator"
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = witness_method $T, #Sequence.makeIterator!1 : <Self where Self : Sequence> (Self) -> () -> Self.Iterator : $@convention(witness_method: Sequence) <τ_0_0 where τ_0_0 : Sequence> (@in_guaranteed τ_0_0) -> @out τ_0_0.Iterator
// CHECK: apply [[MAKE_ITERATOR_FUNC]]<T>([[PROJECT_ITERATOR_BOX]], [[COLLECTION]])
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = witness_method $T, #Sequence.makeIterator!1
// CHECK: apply [[MAKE_ITERATOR_FUNC]]<T>([[PROJECT_ITERATOR_BOX]], [[COLLECTION_COPY:%.*]])
// CHECK: [[ELT_STACK:%.*]] = alloc_stack $Optional<T.Element>
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
//
Expand Down
37 changes: 27 additions & 10 deletions test/SILGen/value_ownership.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,56 @@ protocol OwnershipProto {
__consuming func elided(_ default: String, _ shared: __shared String, _ owned: __owned String)

__consuming func explicit(_ default: String, _ shared: __shared String, _ owned: __owned String)

var elidedPropertyGet: String { __consuming get }
var explicitPropertyGet: String { __consuming get }
}

struct Witness: OwnershipProto {
var x: String

func elided(_ default: String, _ shared: String, _ owned: String) { }

__consuming func explicit(_ default: String, _ toShared: __shared String, _ toOwned: __owned String) { }

var elidedPropertyGet: String { return "" }
var explicitPropertyGet: String { __consuming get { return "" } }
}

// Check the conventions of the witnesses

// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV6elidedyySS_S2StF : $@convention(method) (@guaranteed String, @guaranteed String, @guaranteed String, Witness) -> () {
// CHECK: } // end sil function '$s15value_ownership7WitnessV6elidedyySS_S2StF'

// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV8explicityySS_SShSSntF : $@convention(method) (@guaranteed String, @guaranteed String, @owned String, Witness) -> () {
// CHECK: } // end sil function '$s15value_ownership7WitnessV8explicityySS_SShSSntF'
// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV6elidedyySS_S2StF : $@convention(method) (@guaranteed String, @guaranteed String, @guaranteed String, @guaranteed Witness) -> () {
// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV8explicityySS_SShSSntF : $@convention(method) (@guaranteed String, @guaranteed String, @owned String, @owned Witness) -> () {
// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV17elidedPropertyGetSSvg : $@convention(method) (@guaranteed Witness) -> @owned String
// CHECK-LABEL: sil hidden @$s15value_ownership7WitnessV19explicitPropertyGetSSvg : $@convention(method) (@owned Witness) -> @owned String

// Check the elided witness' thunk has the right conventions and borrows where necessary

// CHECK-LABEL: @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP6elidedyySS_SShSSntFTW : $@convention(witness_method: OwnershipProto) (@guaranteed String, @guaranteed String, @owned String, @in_guaranteed Witness) -> ()
// CHECK-LABEL: @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP6elidedyySS_SShSSntFTW : $@convention(witness_method: OwnershipProto) (@guaranteed String, @guaranteed String, @owned String, @in Witness) -> ()
// CHECK: bb0([[DEFAULT2DEFAULT:%.*]] : @guaranteed $String, [[SHARED2DEFAULT:%.*]] : @guaranteed $String, [[OWNED2DEFAULT:%.*]] : @owned $String, [[WITNESS_VALUE:%.*]] : @trivial $*Witness):
// CHECK: [[LOAD_WITNESS:%.*]] = load [trivial] [[WITNESS_VALUE]] : $*Witness
// CHECK: [[LOAD_WITNESS:%.*]] = load [take] [[WITNESS_VALUE]] : $*Witness
// CHECK: [[BORROW_WITNESS:%.*]] = begin_borrow [[LOAD_WITNESS]]
// CHECK: [[WITNESS_FUNC:%.*]] = function_ref @$s15value_ownership7WitnessV6elidedyySS_S2StF
// CHECK: [[BORROWOWNED2DEFAULT:%.*]] = begin_borrow [[OWNED2DEFAULT]] : $String
// CHECK: apply [[WITNESS_FUNC]]([[DEFAULT2DEFAULT]], [[SHARED2DEFAULT]], [[BORROWOWNED2DEFAULT]], [[LOAD_WITNESS]])
// CHECK: apply [[WITNESS_FUNC]]([[DEFAULT2DEFAULT]], [[SHARED2DEFAULT]], [[BORROWOWNED2DEFAULT]], [[BORROW_WITNESS]])
// CHECK: end_borrow [[BORROWOWNED2DEFAULT]] : $String
// CHECK: end_borrow [[BORROW_WITNESS]]
// CHECK: destroy_value [[LOAD_WITNESS]]
// CHECK: } // end sil function '$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP6elidedyySS_SShSSntFTW'

// Check that the explicit witness' thunk doesn't copy or borrow

// CHECK-LABEL: @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP8explicityySS_SShSSntFTW : $@convention(witness_method: OwnershipProto) (@guaranteed String, @guaranteed String, @owned String, @in_guaranteed Witness) -> () {
// CHECK-LABEL: @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP8explicityySS_SShSSntFTW : $@convention(witness_method: OwnershipProto) (@guaranteed String, @guaranteed String, @owned String, @in Witness) -> () {
// CHECK: bb0([[ARG0:%.*]] : @guaranteed $String, [[ARG1:%.*]] : @guaranteed $String, [[ARG2:%.*]] : @owned $String, [[WITNESS_VALUE:%.*]] : @trivial $*Witness):
// CHECK-NEXT: [[LOAD_WITNESS:%.*]] = load [trivial] [[WITNESS_VALUE]] : $*Witness
// CHECK-NEXT: [[LOAD_WITNESS:%.*]] = load [take] [[WITNESS_VALUE]] : $*Witness
// CHECK-NEXT: // function_ref Witness.explicit(_:_:_:)
// CHECK-NEXT: [[WITNESS_FUNC:%.*]] = function_ref @$s15value_ownership7WitnessV8explicityySS_SShSSntF
// CHECK-NEXT: apply [[WITNESS_FUNC]]([[ARG0]], [[ARG1]], [[ARG2]], [[LOAD_WITNESS]])
// CHECK: } // end sil function '$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP8explicityySS_SShSSntFTW'

// Check the signature of the property accessor witness thunks.
// If a protocol asks for a __consuming get it should get a +1-in +1-out
// accessor entry point in its witness table.

// CHECK-LABEL: sil private [transparent] [thunk] @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP17elidedPropertyGetSSvgTW : $@convention(witness_method: OwnershipProto) (@in Witness) -> @owned String
// CHECK-LABEL: sil private [transparent] [thunk] @$s15value_ownership7WitnessVAA14OwnershipProtoA2aDP19explicitPropertyGetSSvgTW : $@convention(witness_method: OwnershipProto) (@in Witness) -> @owned String
2 changes: 1 addition & 1 deletion test/SILGen/witness_same_type.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Foo: Fooable {
}

// rdar://problem/19049566
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @$s17witness_same_type14LazySequenceOfVyxq_GSTAAST12makeIterator0H0QzyFTW : $@convention(witness_method: Sequence) <τ_0_0, τ_0_1 where τ_0_0 : Sequence, τ_0_1 == τ_0_0.Element> (@in_guaranteed LazySequenceOf<τ_0_0, τ_0_1>) -> @out AnyIterator<τ_0_1>
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @$s17witness_same_type14LazySequenceOfVyxq_GSTAAST12makeIterator0H0QzyFTW : $@convention(witness_method: Sequence) <τ_0_0, τ_0_1 where τ_0_0 : Sequence, τ_0_1 == τ_0_0.Element> (@in LazySequenceOf<τ_0_0, τ_0_1>) -> @out AnyIterator<τ_0_1>
public struct LazySequenceOf<SS : Sequence, A> : Sequence where SS.Iterator.Element == A {
public func makeIterator() -> AnyIterator<A> {
var opt: AnyIterator<A>?
Expand Down
2 changes: 1 addition & 1 deletion test/Sema/fixed_ambiguities/rdar27033993.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class S {}
let arr: [(S, Int)] = []
let _: [S] = arr.sorted {
$0.1 < $1.1
// CHECK: function_ref @$sSlsE6prefixy11SubSequenceQzSiF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (Int, @in_guaranteed τ_0_0) -> @out τ_0_0.SubSequence
// CHECK: function_ref @$sSlsE6prefixy11SubSequenceQzSiF
}.prefix(1).map {
return $0.0
}
2 changes: 1 addition & 1 deletion test/Sema/fixed_ambiguities/rdar27198177.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

let arr = ["A", "B", "C"]
let lazy: LazyMapCollection = arr.lazy.map { $0 }
// CHECK: function_ref @$ss22LazyCollectionProtocolPsE6filterys0a6FilterB0Vy8ElementsQzGSb7ElementQzcF : $@convention(method) <τ_0_0 where τ_0_0 : LazyCollectionProtocol> (@guaranteed @callee_guaranteed (@in_guaranteed τ_0_0.Element) -> Bool, @in_guaranteed τ_0_0) -> @out LazyFilterCollection<τ_0_0.Elements>
// CHECK: function_ref @$ss22LazyCollectionProtocolPsE6filterys0a6FilterB0Vy8ElementsQzGSb7ElementQzcF
_ = lazy.filter { $0 > "A" }.count
2 changes: 1 addition & 1 deletion test/Sema/fixed_ambiguities/rdar33142386.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// RUN: %target-swift-frontend -emit-sil -verify %s -swift-version 4 | %FileCheck %s

let x: String = "ultimate question"
// CHECK: function_ref @$sSmsE6filteryxSb7ElementQzKXEKF : $@convention(method) <τ_0_0 where τ_0_0 : RangeReplaceableCollection> (@noescape @callee_guaranteed (@in_guaranteed τ_0_0.Element) -> (Bool, @error Error), @in_guaranteed τ_0_0) -> (@out τ_0_0, @error Error)
// CHECK: function_ref @$sSmsE6filteryxSb7ElementQzKXEKF
_ = x.filter({ $0 == " " }).count < 3
2 changes: 1 addition & 1 deletion test/Sema/fixed_ambiguities/rdar35624855.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

extension Collection {
func foo() {
// CHECK: witness_method $Self.Indices, #Sequence.dropFirst!1 : <Self where Self : Sequence> (Self) -> (Int) -> Self.SubSequence : $@convention(witness_method: Sequence) <τ_0_0 where τ_0_0 : Sequence> (Int, @in_guaranteed τ_0_0) -> @out τ_0_0.SubSequence
// CHECK: witness_method $Self.Indices, #Sequence.dropFirst!1
_ = zip(indices, indices.dropFirst(3))
}
}
2 changes: 1 addition & 1 deletion test/Sema/fixed_ambiguities/rdar35625339.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-sil -verify %s | %FileCheck %s
let arr = Array(10...20)
// CHECK: function_ref @$sSlsE6prefixy11SubSequenceQzSiF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (Int, @in_guaranteed τ_0_0) -> @out τ_0_0.SubSequence
// CHECK: function_ref @$sSlsE6prefixy11SubSequenceQzSiF
arr.prefix(3).forEach { (v: Int) in }
Loading