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
@c @implementation relies on matching the original C declaration. The
lookup for the original C declaration was doing the wrong kind of
lookup, meaning that it could only find the C declaration if it came
through a bridging header, and not through a normal module import.
Using unqualified lookup here finds the name appropriately.
Clarify the diagnostics here as well to not talk about umbrella and
bridging headers.
Fixes rdar://161909754.
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure your umbrella or bridging header imports the header that declares it}}
33
+
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure you import the module or header that declares it}}
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure your umbrella or bridging header imports the header that declares it}}
48
+
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure you import the module or header that declares it}}
43
49
// FIXME: Improve diagnostic for a partial match.
44
50
}
45
51
46
52
@implementation@c(mismatchedName2)
47
53
func CImplFuncNameMismatch2(_:Int32){
48
-
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure your umbrella or bridging header imports the header that declares it}}
54
+
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure you import the module or header that declares it}}
49
55
// FIXME: Improve diagnostic for a partial match.
50
56
}
51
57
@@ -56,14 +62,14 @@ var cImplComputedGlobal1: Int32 {
56
62
@implementation@c(CImplGetComputedGlobal1)
57
63
get{
58
64
// FIXME: Lookup for vars isn't working yet
59
-
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
65
+
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
60
66
return0
61
67
}
62
68
63
69
@implementation@c(CImplSetComputedGlobal1)
64
70
set{
65
71
// FIXME: Lookup for vars isn't working yet
66
-
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
72
+
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
67
73
print(newValue)
68
74
}
69
75
}
@@ -77,6 +83,6 @@ extension CImplStruct {
77
83
// FIXME: Add underlying support for this
78
84
// expected-error@-3 {{@c can only be applied to global functions}}
79
85
// FIXME: Lookup in an enclosing type is not working yet
80
-
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure your umbrella or bridging header imports the header that declares it}}
86
+
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure you import the module or header that declares it}}
Copy file name to clipboardExpand all lines: test/decl/ext/objc_implementation.swift
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -503,7 +503,7 @@ protocol EmptySwiftProto {}
503
503
// expected-warning@-1 {{extension with Objective-C category name 'PresentAdditions' conflicts with previous extension with the same category name; this is an error in the Swift 6 language mode}}
// expected-error@-1 {{could not find category 'MissingAdditions' on Objective-C class 'ObjCClass'; make sure your umbrella or bridging header imports the header that declares it}}
506
+
// expected-error@-1 {{could not find category 'MissingAdditions' on Objective-C class 'ObjCClass'; make sure you import the module or header that declares it}}
507
507
// expected-note@-2 {{remove arguments to implement the main '@interface' for this class}} {{6-24=}}
508
508
509
509
@objc@implementationextensionObjCStruct{}
@@ -558,7 +558,7 @@ func CImplFunc2(_: Int32) {
558
558
559
559
@implementation@_cdecl("CImplFuncMissing")
560
560
func CImplFuncMissing(_:Int32){
561
-
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure your umbrella or bridging header imports the header that declares it}}
561
+
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure you import the module or header that declares it}}
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure your umbrella or bridging header imports the header that declares it}}
617
+
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure you import the module or header that declares it}}
618
618
// FIXME: Improve diagnostic for a partial match.
619
619
}
620
620
621
621
@implementation@_cdecl("mismatchedName2")
622
622
func CImplFuncNameMismatch2(_:Int32){
623
-
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure your umbrella or bridging header imports the header that declares it}}
623
+
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure you import the module or header that declares it}}
624
624
// FIXME: Improve diagnostic for a partial match.
625
625
}
626
626
@@ -631,14 +631,14 @@ var cImplComputedGlobal1: Int32 {
631
631
@implementation@_cdecl("CImplGetComputedGlobal1")
632
632
get{
633
633
// FIXME: Lookup for vars isn't working yet
634
-
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
634
+
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
635
635
return0
636
636
}
637
637
638
638
@implementation@_cdecl("CImplSetComputedGlobal1")
639
639
set{
640
640
// FIXME: Lookup for vars isn't working yet
641
-
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
641
+
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
642
642
print(newValue)
643
643
}
644
644
}
@@ -652,7 +652,7 @@ extension CImplStruct {
652
652
// FIXME: Add underlying support for this
653
653
// expected-error@-3 {{@_cdecl can only be applied to global functions}}
654
654
// FIXME: Lookup in an enclosing type is not working yet
655
-
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure your umbrella or bridging header imports the header that declares it}}
655
+
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure you import the module or header that declares it}}
Copy file name to clipboardExpand all lines: test/decl/ext/objc_implementation_early_adopter.swift
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -507,7 +507,7 @@ protocol EmptySwiftProto {}
507
507
// expected-warning@-1 {{extension with Objective-C category name 'PresentAdditions' conflicts with previous extension with the same category name; this is an error in the Swift 6 language mode}}
// expected-error@-1 {{could not find category 'MissingAdditions' on Objective-C class 'ObjCClass'; make sure your umbrella or bridging header imports the header that declares it}}
510
+
// expected-error@-1 {{could not find category 'MissingAdditions' on Objective-C class 'ObjCClass'; make sure you import the module or header that declares it}}
511
511
// expected-note@-2 {{remove arguments to implement the main '@interface' for this class}} {{21-39=}}
512
512
513
513
@_objcImplementationextensionObjCStruct{}
@@ -549,7 +549,7 @@ func CImplFunc2(_: Int32) {
549
549
550
550
@_objcImplementation@_cdecl("CImplFuncMissing")
551
551
func CImplFuncMissing(_:Int32){
552
-
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure your umbrella or bridging header imports the header that declares it}}
552
+
// expected-error@-2 {{could not find imported function 'CImplFuncMissing' matching global function 'CImplFuncMissing'; make sure you import the module or header that declares it}}
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure your umbrella or bridging header imports the header that declares it}}
608
+
// expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure you import the module or header that declares it}}
609
609
// FIXME: Improve diagnostic for a partial match.
610
610
}
611
611
612
612
@_objcImplementation@_cdecl("mismatchedName2")
613
613
func CImplFuncNameMismatch2(_:Int32){
614
-
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure your umbrella or bridging header imports the header that declares it}}
614
+
// expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure you import the module or header that declares it}}
615
615
// FIXME: Improve diagnostic for a partial match.
616
616
}
617
617
@@ -622,14 +622,14 @@ var cImplComputedGlobal1: Int32 {
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
625
+
// expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure your umbrella or bridging header imports the header that declares it}}
632
+
// expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}}
633
633
print(newValue)
634
634
}
635
635
}
@@ -643,7 +643,7 @@ extension CImplStruct {
643
643
// FIXME: Add underlying support for this
644
644
// expected-error@-3 {{@_cdecl can only be applied to global functions}}
645
645
// FIXME: Lookup in an enclosing type is not working yet
646
-
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure your umbrella or bridging header imports the header that declares it}}
646
+
// expected-error@-5 {{could not find imported function 'CImplStructStaticFunc1' matching static method 'staticFunc1'; make sure you import the module or header that declares it}}
0 commit comments