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
4 changes: 1 addition & 3 deletions lib/Sema/CSGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ namespace {
if (auto *VD = dyn_cast<VarDecl>(E->getDecl())) {
knownType = CS.getTypeIfAvailable(VD);
if (!knownType)
knownType = VD->getInterfaceType();
knownType = VD->getType();

if (knownType) {
assert(!knownType->isHole());
Expand All @@ -1432,8 +1432,6 @@ namespace {
}

// Set the favored type for this expression to the known type.
if (knownType->hasTypeParameter())
knownType = VD->getDeclContext()->mapTypeIntoContext(knownType);
CS.setFavoredType(E, knownType.getPointer());
}

Expand Down
3 changes: 1 addition & 2 deletions test/decl/protocol/req/recursion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public struct S<A: P> where A.T == S<A> { // expected-error {{circular reference
// expected-error@-2 {{generic struct 'S' references itself}}
// expected-note@-3 {{while resolving type 'S<A>'}}
func f(a: A.T) {
g(a: id(t: a))
// expected-error@-1 {{type of expression is ambiguous without more context}}
g(a: id(t: a)) // `a` has error type which is diagnosed as circular reference
_ = A.T.self
}

Expand Down