Skip to content

Commit 5d6c20b

Browse files
committed
fix 058-swift-constraints-constraintsystem-diagnosefailureforexpr.swift
CSDiag's wasn't considering the case when an operator was invalid and had ErrorType.
1 parent c7e8cb0 commit 5d6c20b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,11 @@ namespace {
10711071
// If this is an operator func decl in a type context, the 'self' isn't
10721072
// actually going to be applied.
10731073
if (auto *fd = dyn_cast<FuncDecl>(decl))
1074-
if (fd->isOperator() && fd->getDeclContext()->isTypeContext())
1074+
if (fd->isOperator() && fd->getDeclContext()->isTypeContext()) {
1075+
if (type->is<ErrorType>())
1076+
return nullptr;
10751077
type = type->castTo<AnyFunctionType>()->getResult();
1078+
}
10761079

10771080
for (unsigned i = 0, e = level; i != e; ++i) {
10781081
auto funcTy = type->getAs<AnyFunctionType>();

validation-test/IDE/crashers/058-swift-constraints-constraintsystem-diagnosefailureforexpr.swift

Lines changed: 0 additions & 4 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
2+
class T{var f=Dictionary<T
3+
protocol A{func<:u
4+
#^A^#

0 commit comments

Comments
 (0)