Native: fix cinterop for Swift-produced Objective-C categories
For some reason, libclang's indexer doesn't index categories with __attribute__((external_source_symbol(language="Swift",...))), so we have to additionally enumerate them explicitly. ^KT-49455 Fixed
This commit is contained in:
committed by
Space
parent
f1623347d8
commit
d8b1992fde
@@ -0,0 +1,17 @@
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
// https://youtrack.jetbrains.com/issue/KT-49455
|
||||
|
||||
@interface KT49455 : NSObject
|
||||
@end;
|
||||
|
||||
__attribute__((external_source_symbol(language="Swift", defined_in="sample",generated_declaration)))
|
||||
@interface KT49455 (KT49455Ext)
|
||||
- (int)extensionFunction;
|
||||
@end
|
||||
|
||||
// Just to ensure that unavailable categories don't break anything.
|
||||
__attribute__((unavailable("unavailableExtensionFunction is unavailable")))
|
||||
@interface KT49455 (KT49455UnavailableExt)
|
||||
- (int)unavailableExtensionFunction;
|
||||
@end
|
||||
@@ -0,0 +1,7 @@
|
||||
import kotlin.test.*
|
||||
import objcTests.*
|
||||
|
||||
@Test
|
||||
fun testKT49455() {
|
||||
assertEquals(111, KT49455().extensionFunction())
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#import "kt49455.h"
|
||||
|
||||
@implementation KT49455
|
||||
@end;
|
||||
|
||||
@implementation KT49455 (KT49455Ext)
|
||||
- (int)extensionFunction {
|
||||
return 111;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user