diff --git a/lib/Sema/TypeCheckGeneric.cpp b/lib/Sema/TypeCheckGeneric.cpp index 0e860c8ec4a57..c96d94d1702f8 100644 --- a/lib/Sema/TypeCheckGeneric.cpp +++ b/lib/Sema/TypeCheckGeneric.cpp @@ -506,7 +506,6 @@ void TypeChecker::checkReferencedGenericParams(GenericContext *dc) { // Produce an error that this generic parameter cannot be bound. paramDecl->diagnose(diag::unreferenced_generic_parameter, paramDecl->getNameStr()); - decl->setInvalid(); } } } diff --git a/test/AutoDiff/Sema/derivative_attr_type_checking.swift b/test/AutoDiff/Sema/derivative_attr_type_checking.swift index 69edbf96a67b3..8e99b4bdab4e0 100644 --- a/test/AutoDiff/Sema/derivative_attr_type_checking.swift +++ b/test/AutoDiff/Sema/derivative_attr_type_checking.swift @@ -79,6 +79,16 @@ func vjpOriginalFunctionNotFound(_ x: Float) -> (value: Float, pullback: (Float) fatalError() } +struct Q { } + +@derivative(of: remainder(_:_:)) // expected-error {{cannot find 'remainder' in scope}} +// expected-error @+1 {{generic parameter 'T' is not used in function signature}} +func _vjpRemainder(_ x: Q, _ y: Q) -> ( + value: Q, pullback: (Q) -> (Q, Q) +) { + fatalError() +} + // Test `@derivative` attribute where `value:` result does not conform to `Differentiable`. // Invalid original function should be diagnosed first. // expected-error @+1 {{cannot find 'nonexistentFunction' in scope}} diff --git a/test/Constraints/overload.swift b/test/Constraints/overload.swift index 34da8f7e4bda2..85ab17e5eb6e1 100644 --- a/test/Constraints/overload.swift +++ b/test/Constraints/overload.swift @@ -187,12 +187,12 @@ R_28051973().f(r28051973) // expected-error {{cannot use mutating member on immu // Fix for CSDiag vs CSSolver disagreement on what constitutes a // valid overload. -func overloadedMethod(n: Int) {} // expected-note {{'overloadedMethod(n:)' declared here}} -func overloadedMethod() {} +func overloadedMethod(n: Int) {} +func overloadedMethod() {} // expected-note {{in call to function 'overloadedMethod()'}} // expected-error@-1 {{generic parameter 'T' is not used in function signature}} overloadedMethod() -// expected-error@-1 {{missing argument for parameter 'n' in call}} +// expected-error@-1 {{generic parameter 'T' could not be inferred}} // Ensure we select the overload of '??' returning T? rather than T. func SR3817(_ d: [String : Any], _ s: String, _ t: String) -> Any { diff --git a/test/Generics/unbound.swift b/test/Generics/unbound.swift index 88e30dc03954e..a1b23cab56515 100644 --- a/test/Generics/unbound.swift +++ b/test/Generics/unbound.swift @@ -51,8 +51,10 @@ extension GC { class SomeClassWithInvalidMethod { - func method() { // expected-error {{generic parameter 'T' is not used in function signature}} + func method() { // expected-note {{in call to function 'method()'}} + // expected-error@-1 {{generic parameter 'T' is not used in function signature}} self.method() + // expected-error@-1 {{generic parameter 'T' could not be inferred}} } }