Skip to content

Commit e58ae76

Browse files
committed
Fix and un-XFAIL regressed crashers from recent stdlib change
1 parent 9487a1e commit e58ae76

16 files changed

+14
-20
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4584,7 +4584,15 @@ void ConformanceChecker::resolveTypeWitnesses() {
45844584
auto &typeWitnesses = solutions.front().TypeWitnesses;
45854585
for (auto assocType : unresolvedAssocTypes) {
45864586
assert(typeWitnesses.count(assocType) == 1 && "missing witness");
4587-
recordTypeWitness(assocType, typeWitnesses[assocType].first, nullptr, true);
4587+
auto replacement = typeWitnesses[assocType].first;
4588+
// FIXME: We can end up here with dependent types that were not folded
4589+
// away for some reason.
4590+
if (replacement.findIf([](Type t) -> bool {
4591+
return isa<DependentMemberType>(t.getPointer());
4592+
})) {
4593+
replacement = ErrorType::get(TC.Context);
4594+
}
4595+
recordTypeWitness(assocType, replacement, nullptr, true);
45884596
}
45894597

45904598
return;

test/decl/protocol/conforms/failure.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ struct P5Conformer : P5 { // expected-error {{does not conform}}
7777
protocol P6Base {
7878
associatedtype Foo
7979
func foo()
80-
func bar() -> Foo // expected-note{{protocol requires function 'bar()' with type '() -> P6Conformer.Bar?'; do you want to add a stub?}}
80+
func bar() -> Foo
8181
}
8282
extension P6Base {
8383
}
8484
protocol P6 : P6Base {
8585
associatedtype Bar // expected-note {{protocol requires nested type 'Bar'}}
8686
}
8787
extension P6 {
88-
func bar() -> Bar? { return nil } // expected-note{{candidate has non-matching type '<Self> () -> Self.Bar?' [with Foo = P6Conformer.Bar?]}}
88+
func bar() -> Bar? { return nil }
8989
}
9090

91-
struct P6Conformer : P6 { // expected-error 2 {{does not conform}}
91+
struct P6Conformer : P6 { // expected-error {{does not conform}}
9292
func foo() {}
9393
}
9494

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
22
// RUN: %target-swift-ide-test -code-completion -code-completion-token=B -source-filename=%s | %FileCheck %s
3-
// XFAIL: *
43

54
func test1() {
65
1 + [0]#^A^#
@@ -9,4 +8,4 @@ func test2() {
98
"" + [""]#^B^#
109
}
1110
// Sanity check results.
12-
// CHECK: Decl[InfixOperatorFunction]/OtherModule[Swift]: ==
11+
// CHECK: Decl[InstanceVar]/CurrNominal: .startIndex[#Int#]; name=startIndex

validation-test/compiler_crashers_2_fixed/0019-rdar21511651.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: not %target-swift-frontend %s -typecheck
2-
// XFAIL: *
32

43
internal protocol _SequenceWrapper {
54
typealias Base : Sequence

validation-test/compiler_crashers_2_fixed/0020-rdar21598514.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: not %target-swift-frontend %s -typecheck
2-
// XFAIL: *
32

43
protocol Resettable : AnyObject {
54
func reset()

validation-test/compiler_crashers_fixed/23086-swift-typechecker-validatedecl.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
struct Q<T,j{
1110
class a
1211
struct D:Collection

validation-test/compiler_crashers_fixed/24915-swift-typebase-getcanonicaltype.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
struct B<T where B:A{{}struct c<T{struct d:Collection

validation-test/compiler_crashers_fixed/25011-swift-constraints-constraintsystem-opengeneric.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
enum S<T where B:a{enum S:Collection

validation-test/compiler_crashers_fixed/26148-swift-typebase-getmembersubstitutions.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
class B}struct B<T struct S<T{struct S<T let:{<T
1110
protocol c
1211
struct S<g{class A

validation-test/compiler_crashers_fixed/27034-swift-typechecker-validatedecl.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
func b
1110
{
1211
{class A{class A:Collection

validation-test/compiler_crashers_fixed/27352-swift-astprinter-printtextimpl.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
func b{struct Q<T where g:c{enum S{{}class a{class B{struct B{enum S<a{struct B{class a{struct Q{struct D:Collection

validation-test/compiler_crashers_fixed/27387-swift-structtype-get.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -typecheck
9-
// XFAIL: *
109
{struct Q<T{struct g:Collection}struct B<T:T.E

validation-test/compiler_crashers_fixed/28041-swift-typechecker-lookupunqualified.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// Test is no longer valid as there is no longer `map` as a free function in Swift 3
9-
// XFAIL: *
109
// DUPLICATE-OF: 26813-generic-enum-tuple-optional-payload.swift
11-
// RUN: not --crash %target-swift-frontend %s -typecheck
10+
// RUN: not %target-swift-frontend %s -typecheck
1211
let a{{map($0

validation-test/compiler_crashers_fixed/28577-isa-x-val-cast-ty-argument-of-incompatible-type.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -emit-ir
9-
// XFAIL: *
109
class a<U:a>:RangeReplaceableCollection

validation-test/compiler_crashers_fixed/28666-conformingreplacementtype-is-substitutabletype-conformingreplacementtype-is-depe.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -emit-ir
9-
// XFAIL: *
109
struct A:RangeReplaceableCollection{var f=max

validation-test/compiler_crashers_fixed/28670-reftype-hastypeparameter-cannot-have-a-dependent-type-here.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// RUN: not %target-swift-frontend %s -emit-ir
9-
// XFAIL: *
109
struct A:RangeReplaceableCollection{let c{{a f{}}var f=max

0 commit comments

Comments
 (0)