Skip to content

Commit d38198b

Browse files
authored
Merge pull request #5063 from graydon/rdar-27982012-poor-diagnostic
2 parents 8bedace + 0d5420b commit d38198b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5279,6 +5279,10 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
52795279
argLabels))
52805280
return true;
52815281

5282+
// Diagnose some simple and common errors.
5283+
if (calleeInfo.diagnoseSimpleErrors(callExpr))
5284+
return true;
5285+
52825286
// Force recheck of the arg expression because we allowed unresolved types
52835287
// before, and that turned out not to help, and now we want any diagnoses
52845288
// from disallowing them.
@@ -5287,10 +5291,6 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
52875291
if (!argExpr)
52885292
return true; // already diagnosed.
52895293

5290-
// Diagnose some simple and common errors.
5291-
if (calleeInfo.diagnoseSimpleErrors(callExpr))
5292-
return true;
5293-
52945294
// A common error is to apply an operator that only has inout forms (e.g. +=)
52955295
// to non-lvalues (e.g. a local let). Produce a nice diagnostic for this
52965296
// case.

test/NameBinding/accessibility.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ _ = Foo() // expected-error {{'Foo' initializer is inaccessible due to 'internal
5454
// <rdar://problem/27982012> QoI: Poor diagnostic for inaccessible initializer
5555
struct rdar27982012 {
5656
var x: Int
57-
private init(_ x: Int) { self.x = x }
57+
private init(_ x: Int) { self.x = x } // expected-note {{'init' declared here}}
5858
}
5959

60-
_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{type of expression is ambiguous without more context}}
60+
_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{initializer is inaccessible due to 'private' protection level}}
6161

6262
// TESTABLE-NOT: :[[@LINE-1]]:{{[^:]+}}:
6363
_ = PrivateInit() // expected-error {{'PrivateInit' initializer is inaccessible due to 'private' protection level}}

0 commit comments

Comments
 (0)