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
Sema: Look through missing imports during qualified type lookup.
To improve knock-on diagnostics, resolve qualified types to their matching
member type declarations regardless of whether an import is missing when the
`MemberImportVisibility` features is enabled.
Part of rdar://126637855.
_ = x.memberInMixedUses // expected-error {{property 'memberInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
46
48
}
47
49
48
-
//--- function_signatures.swift
50
+
//--- function_signatures_unqualified.swift
49
51
50
52
import Swift // Just here to anchor the fix-its
51
53
// expected-note 2 {{add import of module 'InternalUsesOnly'}}{{1-1=internal import InternalUsesOnly\n}}
@@ -64,6 +66,57 @@ extension Int {
64
66
internalfunc usesTypealiasInMixedUses_Internal(x:TypealiasInMixedUses){} // expected-error {{type alias 'TypealiasInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
65
67
}
66
68
69
+
//--- function_signatures_qualified.swift
70
+
71
+
import Swift // Just here to anchor the fix-its
72
+
// expected-note 2 {{add import of module 'InternalUsesOnly'}}{{1-1=internal import InternalUsesOnly\n}}
73
+
// expected-note@-1 {{add import of module 'PackageUsesOnly'}}{{1-1=package import PackageUsesOnly\n}}
74
+
// expected-note@-2 {{add import of module 'PublicUsesOnly'}}{{1-1=public import PublicUsesOnly\n}}
75
+
// expected-note@-3 2 {{add import of module 'MixedUses'}}{{1-1=public import MixedUses\n}}
76
+
77
+
privatefunc usesTypealiasInInternalUsesOnly_Private(x:Int.TypealiasInInternalUsesOnly){} // expected-error {{type alias 'TypealiasInInternalUsesOnly' is not available due to missing import of defining module 'InternalUsesOnly'}}
78
+
internalfunc usesTypealiasInInternalUsesOnly(x:Int.TypealiasInInternalUsesOnly){} // expected-error {{type alias 'TypealiasInInternalUsesOnly' is not available due to missing import of defining module 'InternalUsesOnly'}}
79
+
packagefunc usesTypealiasInPackageUsesOnly(x:Int.TypealiasInPackageUsesOnly){} // expected-error {{type alias 'TypealiasInPackageUsesOnly' is not available due to missing import of defining module 'PackageUsesOnly'}}
80
+
publicfunc usesTypealiasInPublicUsesOnly(x:Int.TypealiasInPublicUsesOnly){} // expected-error {{type alias 'TypealiasInPublicUsesOnly' is not available due to missing import of defining module 'PublicUsesOnly'}}
81
+
// expected-warning@-1 {{cannot use type alias 'TypealiasInPublicUsesOnly' here; 'PublicUsesOnly' was not imported by this file}}
82
+
publicfunc usesTypealiasInMixedUses(x:Int.TypealiasInMixedUses){} // expected-error {{type alias 'TypealiasInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
83
+
// expected-warning@-1 {{cannot use type alias 'TypealiasInMixedUses' here; 'MixedUses' was not imported by this file}}
84
+
internalfunc usesTypealiasInMixedUses_Internal(x:Int.TypealiasInMixedUses){} // expected-error {{type alias 'TypealiasInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
85
+
86
+
//--- extensions.swift
87
+
88
+
import Swift // Just here to anchor the fix-its
89
+
// expected-note 2 {{add import of module 'InternalUsesOnly'}}{{1-1=internal import InternalUsesOnly\n}}
90
+
// expected-note@-1 {{add import of module 'PackageUsesOnly'}}{{1-1=package import PackageUsesOnly\n}}
91
+
// expected-note@-2 {{add import of module 'PublicUsesOnly'}}{{1-1=public import PublicUsesOnly\n}}
92
+
// expected-note@-3 2 {{add import of module 'MixedUses'}}{{1-1=public import MixedUses\n}}
93
+
94
+
extensionInt.NestedInInternalUsesOnly{ // expected-error {{struct 'NestedInInternalUsesOnly' is not available due to missing import of defining module 'InternalUsesOnly'}}
95
+
privatefunc privateMethod(){}
96
+
}
97
+
98
+
extensionInt.NestedInInternalUsesOnly{ // expected-error {{struct 'NestedInInternalUsesOnly' is not available due to missing import of defining module 'InternalUsesOnly'}}
99
+
internalfunc internalMethod(){}
100
+
}
101
+
102
+
extensionInt.NestedInPackageUsesOnly{ // expected-error {{struct 'NestedInPackageUsesOnly' is not available due to missing import of defining module 'PackageUsesOnly'}}
103
+
packagefunc packageMethod(){}
104
+
}
105
+
106
+
extensionInt.NestedInPublicUsesOnly{ // expected-error {{struct 'NestedInPublicUsesOnly' is not available due to missing import of defining module 'PublicUsesOnly'}}
107
+
// expected-warning@-1 {{cannot use struct 'NestedInPublicUsesOnly' in an extension with public or '@usableFromInline' members; 'PublicUsesOnly' was not imported by this file}}
108
+
publicfunc publicMethod(){}
109
+
}
110
+
111
+
extensionInt.NestedInMixedUses{ // expected-error {{struct 'NestedInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
112
+
// expected-warning@-1 {{cannot use struct 'NestedInMixedUses' in an extension with public or '@usableFromInline' members; 'MixedUses' was not imported by this file}}
113
+
publicfunc publicMethod(){}
114
+
}
115
+
116
+
extensionInt.NestedInMixedUses{ // expected-error {{struct 'NestedInMixedUses' is not available due to missing import of defining module 'MixedUses'}}
0 commit comments