musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

Expose "incorrectly extends base class" errors. #111

Closed iccir closed 8 years ago

iccir commented 8 years ago

Objective-C is more lenient than TypeScript when subclasses override methods and use different parameter types:

@interface Foo : NSObject
- (void) f:(int)bar;
@end

@interface Bar : Foo
- (NSString *) f:(NSString *)bar; // This is fine in Obj-C
@end
declare class Foo {
    f(f : number) : void;
}

declare class Bar extends Foo {
    f(f: string) : string; // This is an error in TypeScript
}

Right now oj strips out this error because it occurs in the defs file. We need to expose this error.