Skip to content

Commit 44f82f2

Browse files
committed
[TypeChecker] Adjust some of tests improved/regressed after removal of UR_LabelMismatch
1 parent e12fe97 commit 44f82f2

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4191,7 +4191,7 @@ bool FailureDiagnosis::diagnoseTrailingClosureErrors(ApplyExpr *callExpr) {
41914191
};
41924192

41934193
SmallPtrSet<TypeBase *, 4> possibleTypes;
4194-
auto currentType = CS.getType(fnExpr);
4194+
auto currentType = CS.simplifyType(CS.getType(fnExpr));
41954195

41964196
// If current type has type variables or unresolved types
41974197
// let's try to re-typecheck it to see if we can get some

test/ClangImporter/objc_parse.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ func testDynamicSelf(_ queen: Bee, wobbler: NSWobbling) {
352352
// class itself.
353353
// FIXME: This should be accepted.
354354
let baseClass: ObjCParseExtras.Base.Type = ObjCParseExtras.Base.returnMyself()
355-
// expected-error@-1 {{missing argument for parameter #1 in call}}
355+
// expected-error@-1 {{instance member 'returnMyself' cannot be used on type 'Base'; did you mean to use a value of this type instead?}}
356+
// expected-error@-2 {{cannot convert value of type 'Base?' to specified type 'Base.Type'}}
356357
}
357358

358359
func testRepeatedProtocolAdoption(_ w: NSWindow) {

test/Constraints/closures.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ func r22162441(_ lines: [String]) {
182182

183183
func testMap() {
184184
let a = 42
185-
[1,a].map { $0 + 1.0 } // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'Double'}}
186-
// expected-note @-1 {{overloads for '+' exist with these partially matching parameter lists: }}
185+
[1,a].map { $0 + 1.0 } // expected-error {{binary operator '+' cannot be applied to operands of type 'Any' and 'Double'}}
186+
// expected-note @-1 {{expected an argument list of type '(Double, Double)'}}
187187
}
188188

189189
// <rdar://problem/22414757> "UnresolvedDot" "in wrong phase" assertion from verifier

test/Constraints/generics.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class r22409190ManagedBuffer<Value, Element> {
161161
class MyArrayBuffer<Element>: r22409190ManagedBuffer<UInt, Element> {
162162
deinit {
163163
self.withUnsafeMutablePointerToElements { elems -> Void in
164-
elems.deinitialize(count: self.value) // expected-error {{cannot convert value of type 'UInt' to expected argument type 'Int'}}
164+
// FIXME(diagnostics): Diagnostic regressed here from `cannot convert value of type 'UInt' to expected argument type 'Int'`.
165+
// Once argument-to-parameter mismatch diagnostics are moved to the new diagnostic framework, we'll be able to restore
166+
// original contextual conversion failure diagnostic here. Note that this only happens in Swift 4 mode.
167+
elems.deinitialize(count: self.value) // expected-error {{ambiguous reference to member 'deinitialize(count:)'}}
165168
}
166169
}
167170
}
@@ -648,7 +651,7 @@ let arr = [BottleLayout]()
648651
let layout = BottleLayout(count:1)
649652
let ix = arr.firstIndex(of:layout) // expected-error {{argument type 'BottleLayout' does not conform to expected type 'Equatable'}}
650653

651-
let _: () -> UInt8 = { .init("a" as Unicode.Scalar) } // expected-error {{initializer 'init(_:)' requires that 'Unicode.Scalar' conform to 'BinaryInteger'}}
654+
let _: () -> UInt8 = { .init("a" as Unicode.Scalar) } // expected-error {{missing argument label 'ascii:' in call}}
652655

653656
// https://bugs.swift.org/browse/SR-9068
654657
func compare<C: Collection, Key: Hashable, Value: Equatable>(c: C)

test/Constraints/overload_filtering_objc.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ import Foundation
1919
}
2020

2121
func testOptional(obj: P) {
22-
// FIXME: When we remove argument-label filtering from member name lookup,
23-
// this will start failing and need to be replaced with "disabled disjunction
24-
// term".
25-
//
26-
// CHECK-NOT: disjunction
22+
// CHECK: disabled disjunction term $T2 bound to decl overload_filtering_objc.(file).P.opt(double:)
2723
_ = obj.opt?(1)
2824
}

test/Sema/diag_ambiguous_overloads.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ struct S {
2626
f({x in x}, 2) // expected-error {{generic parameter 'T' could not be inferred}}
2727
}
2828

29-
func g<T>(_ a: T, _ b: Int) -> Void {}
29+
func g<T>(_ a: T, _ b: Int) -> Void {} // expected-note {{in call to function 'g'}}
3030
func g(_ a: String) -> Void {}
3131
func test2() -> Void {
32-
g(.notAThing, 7) // expected-error {{reference to member 'notAThing' cannot be resolved without a contextual type}}
32+
g(.notAThing, 7) // expected-error {{generic parameter 'T' could not be inferred}}
3333
}
3434

3535
func h(_ a: Int, _ b: Int) -> Void {}

test/stdlib/UnsafePointerDiagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func unsafeRawBufferPointerConversions(
113113
_ = UnsafeRawBufferPointer(start: rp, count: 1)
114114
_ = UnsafeMutableRawBufferPointer(mrbp)
115115
_ = UnsafeRawBufferPointer(mrbp)
116-
_ = UnsafeMutableRawBufferPointer(rbp) // expected-error {{cannot invoke initializer for type 'UnsafeMutableRawBufferPointer' with an argument list of type '(UnsafeRawBufferPointer)'}} expected-note {{overloads for 'UnsafeMutableRawBufferPointer' exist with these partially matching parameter lists: (UnsafeMutableBufferPointer<T>), (UnsafeMutableRawBufferPointer)}}
116+
_ = UnsafeMutableRawBufferPointer(rbp) // expected-error {{missing argument label 'mutating:' in call}}
117117
_ = UnsafeRawBufferPointer(rbp)
118118
_ = UnsafeMutableRawBufferPointer(mbpi)
119119
_ = UnsafeRawBufferPointer(mbpi)

validation-test/Sema/type_checker_crashers_fixed/rdar45470505.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extension BinaryInteger {
44
init(bytes: [UInt8]) { fatalError() }
55

66
init<S: Sequence>(bytes: S) where S.Iterator.Element == UInt8 {
7-
self.init(bytes // expected-error {{no exact matches in call to initializer}}
7+
self.init(bytes // expected-error {{missing argument label 'integerLiteral:' in call}}
88
// expected-note@-1 {{}}
99

1010
extension

0 commit comments

Comments
 (0)