diff --git a/lib/Sema/CSDiag.cpp b/lib/Sema/CSDiag.cpp index 6b1a479c6a0fe..8c8fa4d758615 100644 --- a/lib/Sema/CSDiag.cpp +++ b/lib/Sema/CSDiag.cpp @@ -5278,6 +5278,10 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) { argLabels)) return true; + // Diagnose some simple and common errors. + if (calleeInfo.diagnoseSimpleErrors(callExpr)) + return true; + // Force recheck of the arg expression because we allowed unresolved types // before, and that turned out not to help, and now we want any diagnoses // from disallowing them. @@ -5286,10 +5290,6 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) { if (!argExpr) return true; // already diagnosed. - // Diagnose some simple and common errors. - if (calleeInfo.diagnoseSimpleErrors(callExpr)) - return true; - // A common error is to apply an operator that only has inout forms (e.g. +=) // to non-lvalues (e.g. a local let). Produce a nice diagnostic for this // case. diff --git a/test/NameBinding/accessibility.swift b/test/NameBinding/accessibility.swift index 6c40a84740578..c73e166e97615 100644 --- a/test/NameBinding/accessibility.swift +++ b/test/NameBinding/accessibility.swift @@ -54,10 +54,10 @@ _ = Foo() // expected-error {{'Foo' initializer is inaccessible due to 'internal // QoI: Poor diagnostic for inaccessible initializer struct rdar27982012 { var x: Int - private init(_ x: Int) { self.x = x } + private init(_ x: Int) { self.x = x } // expected-note {{'init' declared here}} } -_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{type of expression is ambiguous without more context}} +_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{initializer is inaccessible due to 'private' protection level}} // TESTABLE-NOT: :[[@LINE-1]]:{{[^:]+}}: _ = PrivateInit() // expected-error {{'PrivateInit' initializer is inaccessible due to 'private' protection level}}