Skip to content
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
7 changes: 7 additions & 0 deletions lib/Sema/TypeCheckType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,13 @@ Type TypeResolver::resolveAttributedType(TypeAttributes &attrs,
if (!ty) ty = resolveType(repr, instanceOptions);
if (!ty || ty->hasError()) return ty;

// Type aliases inside protocols are not yet resolved in the structural
// stage of type resolution
if (ty->is<DependentMemberType>() &&
resolution.getStage() == TypeResolutionStage::Structural) {
return ty;
}

// Handle @escaping
if (hasFunctionAttr && ty->is<FunctionType>()) {
if (attrs.has(TAK_escaping)) {
Expand Down
13 changes: 13 additions & 0 deletions test/attr/attr_escaping.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,16 @@ class HasIVarCaptures {
})()
}
}

// https://bugs.swift.org/browse/SR-9760
protocol SR_9760 {
typealias F = () -> Void
typealias G<T> = (T) -> Void
func foo<T>(_: T, _: @escaping F) // Ok
func bar<T>(_: @escaping G<T>) // Ok
}

extension SR_9760 {
func fiz<T>(_: T, _: @escaping F) {} // Ok
func baz<T>(_: @escaping G<T>) {} // Ok
}