Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. When running `make build` the compiler complains that it “can’t type check this expression in reasonable time” in `ObjectiveCInitExtension.swift`. I put the expression in an explicitly declared variable to help out the compiler’s tiny brain. 2. The test `testPolymorphicPropWithBool` is failing. Looking at the code, we test that an `NSNumber` is a bool via: ``` if ([value isKindOfClass:[NSNumber class]] && strcmp([value objCType], @encode(BOOL)) == 0) { self->_polymorphicProp = [EverythingPolymorphicProp objectWithBoolean:[value boolValue] & 0x1]; } ``` However, I’m seeing weird behavior where `@encode(BOOL)` is not returning `c` as [Apple documentation](https://developer.apple.com/documentation/objectivec/bool) says it should: ``` BOOL is explicitly signed so @encode(BOOL) is c rather than C even if -funsigned-char is used. ``` Here is what I was seeing in the debugger: ``` (lldb) po @encode(BOOL) "B" (lldb) po [@yES objCType] "c" (lldb) po [@no objCType] "c" ``` I am not sure why this is retuning `B`, but it seems a safer check would be: ``` if ([value isKindOfClass:[NSNumber class]] && strcmp([value objCType], [[NSNumber numberWithBool:0] objCType]) == 0) { self->_polymorphicProp = [EverythingPolymorphicProp objectWithBoolean:[value boolValue] & 0x1]; } ``` I added this change to fix the tests.
- Loading branch information