Fix obscure NSTimeZone parsing bug (#440)
* Fix edge case that came up when parsing NSTimeZone
* Property test
* fmt
diff --git a/lib/src/header_parser/type_extractor/extractor.dart b/lib/src/header_parser/type_extractor/extractor.dart
index 7e62d78..1590d73 100644
--- a/lib/src/header_parser/type_extractor/extractor.dart
+++ b/lib/src/header_parser/type_extractor/extractor.dart
@@ -224,7 +224,9 @@
return _CreateTypeFromCursorResult(
parseObjCInterfaceDeclaration(cursor, ignoreFilter: ignoreFilter));
default:
- throw UnimplementedError('Unknown type: ${cxtype.completeStringRepr()}');
+ return _CreateTypeFromCursorResult(
+ UnimplementedType('Unknown type: ${cxtype.completeStringRepr()}'),
+ addToCache: false);
}
}
diff --git a/test/native_objc_test/category_test.dart b/test/native_objc_test/category_test.dart
index 8a8df0b..a424c46 100644
--- a/test/native_objc_test/category_test.dart
+++ b/test/native_objc_test/category_test.dart
@@ -14,7 +14,7 @@
import 'util.dart';
void main() {
- Thing? testInstance;
+ late Thing testInstance;
late CategoryTestObjCLibrary lib;
group('categories', () {
@@ -28,8 +28,10 @@
});
test('Category method', () {
- expect(testInstance!.add_Y_(1000, 234), 1234);
- expect(testInstance!.sub_Y_(1234, 1000), 234);
+ expect(testInstance.add_Y_(1000, 234), 1234);
+ expect(testInstance.sub_Y_(1234, 1000), 234);
+ expect(testInstance.mul_Y_(1234, 1000), 1234000);
+ expect(testInstance.someProperty, 456);
});
});
}
diff --git a/test/native_objc_test/category_test.m b/test/native_objc_test/category_test.m
index bfbf4ae..63cd873 100644
--- a/test/native_objc_test/category_test.m
+++ b/test/native_objc_test/category_test.m
@@ -19,3 +19,19 @@
return x - y;
}
@end
+
+@interface Thing (Mul)
+-(int32_t)mul:(int32_t)x Y:(int32_t) y;
+
+@property (readonly) int32_t someProperty;
+@end
+
+@implementation Thing (Mul)
+-(int32_t)mul:(int32_t)x Y:(int32_t) y {
+ return x * y;
+}
+
+-(int32_t)someProperty {
+ return 456;
+}
+@end
diff --git a/test/native_objc_test/property_test.m b/test/native_objc_test/property_test.m
index 74728e5..117c6d5 100644
--- a/test/native_objc_test/property_test.m
+++ b/test/native_objc_test/property_test.m
@@ -1,10 +1,13 @@
#import <Foundation/NSObject.h>
+@class UndefinedTemplate<ObjectType>;
+
@interface PropertyInterface : NSObject {
}
@property (readonly) int32_t readOnlyProperty;
@property int32_t readWriteProperty;
+@property (class, readonly, copy) UndefinedTemplate<NSString *> *regressGH436;
@property (class, readonly) int32_t classReadOnlyProperty;
@property (class) int32_t classReadWriteProperty;