This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class D {} | |
class D1: D() {} | |
fun D.foo() { | |
println("D.foo") | |
} | |
// this seems like an override, but isn't | |
// It's good that the compiler doesn't let | |
// me add `override`, but it's still not clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Example.h" // https://gist.github.com/hborders/2af9b39e27b62ef9e68c65085126fe4a | |
- (void)missingReturn { | |
Example * _Nonnull fooExample = [[ExampleFoo alloc] initWithF:@"foo" | |
g:@"goo"]; | |
NSNumber * _Nonnull number = | |
[ExampleSwitcher<NSNumber *> nonnullExampleFrom:fooExample | |
switchFoo:^(ExampleFoo * _Nonnull foo_) { | |
return @(foo_.f.length + foo_.g.length); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "MyNonClusteredClass.h" | |
@interface GenericIsKindOfClass<ObjectType : MyNonClusteredClass *> : NSObject | |
+ (instancetype _Nonnull)new NS_UNAVAILABLE; | |
- (instancetype _Nonnull)init NS_UNAVAILABLE; | |
- (instancetype _Nonnull)initWithInstanceOfObjectType:(ObjectType _Nonnull)instanceOfObjectType NS_DESIGNATED_INITIALIZER; | |
- (ObjectType _Nullable)typeSafeDowncastOrNil:(NSObject * _Nonnull)object; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Be sure to run `pod lib lint JiveCommon.podspec' to ensure this is a | |
# valid spec and remove all comments before submitting the spec. | |
# | |
# Any lines starting with a # are optional, but encouraged | |
# | |
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html | |
# | |
Pod::Spec.new do |s| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.BreakIterator; | |
public class UnicodeTest { | |
public static void main(String[] args) { | |
String noel = "noe\u0308l"; | |
System.out.println("noel=" + noel); | |
System.out.println("Broken (java.lang.String methods):"); | |
System.out.println("noel.length=" + noel.length()); | |
System.out.println("noel.substring(0,3)=" + noel.substring(0, 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void badPrintExample(Example * _Nonnull example) { | |
[example switchFoo:^(ExampleBar * _Nonnull bar_) { | |
// ^ | |
// error: incompatible block pointer types sending 'void (^)(ExampleBar * _Nonnull __strong)' to parameter of type 'void (^ _Nonnull)(ExampleFoo * _Nonnull __strong)' | |
NSLog(@"Bar: %@, %@", @(bar_.b), @(bar_.c)); | |
} | |
bar:^(ExampleFoo * _Nonnull foo_) { | |
// ^ | |
// error: incompatible block pointer types sending 'void (^)(ExampleFoo * _Nonnull __strong)' to parameter of type 'void (^ _Nonnull)(ExampleBar * _Nonnull __strong)' | |
NSLog(@"Foo: %@, %@", foo_.f, foo_.g); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)testWrongValues { | |
Example * _Nonnull fooExample = [[ExampleFoo alloc] initWithB:2 c:3]; | |
// ^ | |
// error: no visible @interface for 'ExampleFoo' declares the selector 'initWithB:c:' | |
Example * _Nonnull barExample = [[ExampleBar alloc] initWithF:@"foo" g:@"goo"]; | |
// ^ | |
// error: no visible @interface for 'ExampleBar' declares the selector 'initWithF:g:' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ExampleSwitcher.h" // https://gist.github.com/hborders/f378b4e0d0f1d74ff7c8149cb04c6268 | |
@implementation ExampleSwitcher | |
+ (NSObject * _Nonnull)nonnullValueFrom:(Example * _Nonnull)example | |
switchFoo:(NSObject * _Nonnull (^ _Nonnull)(ExampleFoo * _Nonnull foo_))fooBlock | |
bar:(NSObject * _Nonnull (^ _Nonnull)(ExampleBar * _Nonnull bar_))barBlock { | |
NSParameterAssert(example); | |
NSParameterAssert(fooBlock); | |
NSParameterAssert(barBlock); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Example.h" // https://gist.github.com/hborders/2af9b39e27b62ef9e68c65085126fe4a | |
- (void)missingAssignment { | |
Example * _Nonnull fooExample = [[ExampleFoo alloc] initWithF:@"foo" | |
g:@"goo"]; | |
NSNumber * _Nonnull __block number; | |
[fooExample switchFoo:^(ExampleFoo * _Nonnull foo_) { | |
number = @(foo_.f.length + foo_.g.length); | |
} | |
bar:^(ExampleBar * _Nonnull bar_) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Example.h" // https://gist.github.com/hborders/e00d7ff965ca8f8df8f7e762a2269efb | |
#import "ExampleSwitcher.h" // https://gist.github.com/hborders/f378b4e0d0f1d74ff7c8149cb04c6268 | |
#import "ExampleFoo.h" // https://gist.github.com/hborders/094f05d932b3d7a1e389184ba525b0c3 | |
#import "ExampleBar.h" // https://gist.github.com/hborders/f1c231a89de11157adf46ee85880733a | |
static NSNumber * _Nonnull transformExample(Example * _Nonnull example) { | |
return [ExampleSwitcher<NSNumber *> nonnullValueFrom:example | |
switchFoo:^NSNumber * _Nonnull (ExampleFoo * _Nonnull foo_) { | |
return @(foo_.f.length + foo_.g.length); | |
} |