Skip to content

Commit 50e44f2

Browse files
committed
simplify repro
1 parent c2df13e commit 50e44f2

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

examples/apple/objc_interop/OIPrintStream.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
#import <Foundation/Foundation.h>
1616

1717
/** A very contrived interface for writing strings to a file handle. */
18-
@interface OIPrintStream : NSObject
18+
@interface OIPrintStream<PrintType> : NSObject
1919

2020
- (nonnull instancetype)initWithFileHandle:(nonnull NSFileHandle *)fileHandle;
2121

22+
- (void)print:(nonnull PrintType)message;
23+
2224
- (void)printString:(nonnull NSString *)message;
2325

2426
@end

examples/apple/objc_interop/OIPrintStream.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ - (instancetype)initWithFileHandle:(nonnull NSFileHandle *)fileHandle {
2525
return self;
2626
}
2727

28+
- (void)print:(nonnull id)message {
29+
}
30+
2831
- (void)printString:(nonnull NSString *)message {
2932
NSData *data = [message dataUsingEncoding:NSUTF8StringEncoding];
3033
[_fileHandle writeData:data];

examples/apple/objc_interop/Printer.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@
1515
import Foundation
1616
import examples_apple_objc_interop_PrintStream
1717

18+
@objc public protocol MyStupid {
19+
}
20+
1821
@objc(OIPrinter)
1922
public class Printer: NSObject {
2023

21-
private let stream: OIPrintStream
24+
private let stream: OIPrintStream<MyStupid>
2225
private let prefix: String
2326

2427
@objc public init(prefix: NSString) {
2528
self.stream = OIPrintStream(fileHandle: .standardOutput)
2629
self.prefix = prefix as String
2730
}
2831

32+
@objc public func stream(_ thing: MyStupid) -> OIPrintStream<MyStupid> {
33+
return stream
34+
}
35+
2936
@objc public func print(_ message: NSString) {
3037
stream.print("\(prefix)\(message)")
3138
}

examples/apple/objc_interop_modulemap/OIPrintStream.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
#import <Foundation/Foundation.h>
1616

17-
@protocol Stupid
18-
@end
19-
2017
/** A very contrived interface for writing strings to a file handle. */
2118
@interface OIPrintStream<PrintType> : NSObject
2219

0 commit comments

Comments
 (0)