You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Dependency Scanning] Always record best version of discovered 'canImport'-ed modules
Suppose module 'Foo' exists in the search paths and specifies user module version '1.0'.
If the first encountered 'canImport' query is unversioned:
...
Followed by a versioned one:
...
The success of the first check will record an unversioned successful canImport, which will cause the second check to evaluate to 'true', which is incorrect.
This change causes even unversioned 'canImport' checks to track and record the discovered user module version.
Copy file name to clipboardExpand all lines: test/Parse/ConditionalCompilation/can_import_options.swift
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,10 @@ func canImport() {
9
9
letbasicCheck=1 // expected-warning {{initialization of immutable value 'basicCheck' was never used; consider replacing with assignment to '_' or removing it}}
10
10
#endif
11
11
12
-
#if canImport(Foo, _version: 1)
13
-
// No actual Foo to be imported since it is not versioned.
14
-
letversionCheck=1
12
+
#if canImport(Foo, _version: 1) // expected-warning {{cannot find user version number for module 'Foo'; version number ignored}}
13
+
// TODO(ParserValidation): expected-warning@-1 *{{cannot find user version number for module 'Foo'; version number ignored}}
14
+
// An unversioned 'Foo' causes versioned queries to evaluate to 'true'
15
+
letversionCheck=1 // expected-warning {{initialization of immutable value 'versionCheck' was never used; consider replacing with assignment to '_' or removing it}}
15
16
#endif
16
17
}
17
18
@@ -72,7 +73,8 @@ func canImportVersioned() {
72
73
letextraComponent=1 // expected-warning {{initialization of immutable value 'extraComponent' was never used; consider replacing with assignment to '_' or removing it}}
73
74
#endif
74
75
75
-
#if canImport(Bar, _underlyingVersion: 113.33)
76
+
#if canImport(Bar, _underlyingVersion: 113.33) // expected-warning{{cannot find user version number for Clang module 'Bar'; version number ignored}}
77
+
// TODO(ParserValidation): expected-warning@-1 *{{cannot find user version number for Clang module 'Bar'; version number ignored}}
76
78
// Bar is an unversioned Swift module with no underlying clang module.
77
79
letunderlyingMinorSmaller=1 // expected-warning {{initialization of immutable value 'underlyingMinorSmaller' was never used; consider replacing with assignment to '_' or removing it}}
Copy file name to clipboardExpand all lines: test/Parse/ConditionalCompilation/can_import_version.swift
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -67,8 +67,9 @@ func canImportVersioned() {
67
67
letextraComponent=1 // expected-warning {{initialization of immutable value 'extraComponent' was never used; consider replacing with assignment to '_' or removing it}}
68
68
#endif
69
69
70
-
#if canImport(Foo, _underlyingVersion: 113.33)
71
-
// Foo is an unversioned Swift module with no underlying clang module.
70
+
#if canImport(Foo, _underlyingVersion: 113.33) // expected-warning {{cannot find user version number for Clang module 'Foo'; version number ignored}}
71
+
// TODO(ParserValidation): expected-warning@-1 *{{cannot find user version number for Clang module 'Foo'; version number ignored}}
72
+
// Foo is a Swift module with no underlying clang module.
72
73
letunderlyingMinorSmaller=1 // expected-warning {{initialization of immutable value 'underlyingMinorSmaller' was never used; consider replacing with assignment to '_' or removing it}}
letextraComponent=1 // expected-warning {{initialization of immutable value 'extraComponent' was never used; consider replacing with assignment to '_' or removing it}}
136
137
#endif
137
138
138
-
#if canImport(Foo, _underlyingVersion: "113.33")
139
-
// Foo is an unversioned Swift module with no underlying clang module.
139
+
#if canImport(Foo, _underlyingVersion: "113.33") // expected-warning {{cannot find user version number for Clang module 'Foo'; version number ignored}}
140
+
// TODO(ParserValidation): expected-warning@-1 *{{cannot find user version number for Clang module 'Foo'; version number ignored}}
141
+
// Foo is a Swift module with no underlying clang module.
140
142
letunderlyingMinorSmaller=1 // expected-warning {{initialization of immutable value 'underlyingMinorSmaller' was never used; consider replacing with assignment to '_' or removing it}}
0 commit comments