File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1055,8 +1055,15 @@ CheckInconsistentAccessLevelOnImport::evaluate(
10551055 auto mod = SF->getParentModule ();
10561056 auto diagnose = [mod](const ImportDecl *implicitImport,
10571057 const ImportDecl *otherImport) {
1058- auto otherAccessLevel = otherImport->getAccessLevel ();
1058+ // Ignore files generated by Xcode. We should probably identify them via
1059+ // an attribuite or frontend flag, until them match the file by name.
1060+ SourceFile *implicitSF =
1061+ implicitImport->getDeclContext ()->getParentSourceFile ();
1062+ StringRef basename = llvm::sys::path::filename (implicitSF->getFilename ());
1063+ if (basename == " GeneratedAssetSymbols.swift" )
1064+ return ;
10591065
1066+ auto otherAccessLevel = otherImport->getAccessLevel ();
10601067 auto &diags = mod->getDiags ();
10611068 {
10621069 InFlightDiagnostic error =
Original file line number Diff line number Diff line change @@ -69,3 +69,16 @@ package import Lib // expected-note {{imported 'package' here}} @:1
6969import Lib
7070//--- ManyFiles_AmbiguitySwift6_FileB.swift
7171internal import Lib
72+
73+ /// Don't report inconsistencies from a file generated by Xcode.
74+ // RUN: %target-swift-frontend -typecheck -I %t \
75+ // RUN -primary-file %t/GeneratedAssetSymbols.swift \
76+ // RUN: %t/UserWrittenFile.swift -verify
77+ // RUN: %target-swift-frontend -typecheck -I %t \
78+ // RUN %t/GeneratedAssetSymbols.swift \
79+ // RUN: -primary-file %t/UserWrittenFile.swift -verify
80+ //--- UserWrittenFile.swift
81+ internal import Lib
82+ //--- GeneratedAssetSymbols.swift
83+ import Lib
84+
You can’t perform that action at this time.
0 commit comments