diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 15b1d5ee7a85a..fba6b9a4023c0 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1420,7 +1420,7 @@ namespace { if (auto *VD = dyn_cast(E->getDecl())) { knownType = CS.getTypeIfAvailable(VD); if (!knownType) - knownType = VD->getInterfaceType(); + knownType = VD->getType(); if (knownType) { assert(!knownType->isHole()); @@ -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()); } diff --git a/test/decl/protocol/req/recursion.swift b/test/decl/protocol/req/recursion.swift index 3026cb561d389..f9d9761ee5077 100644 --- a/test/decl/protocol/req/recursion.swift +++ b/test/decl/protocol/req/recursion.swift @@ -48,8 +48,7 @@ public struct S where A.T == S { // expected-error {{circular reference // expected-error@-2 {{generic struct 'S' references itself}} // expected-note@-3 {{while resolving type 'S'}} 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 }