UCSD-PL / refscript

Refinement Types for Scripting Languages
BSD 3-Clause "New" or "Revised" License
65 stars 3 forks source link

Measure and symbol name clash #142

Open panagosg7 opened 8 years ago

panagosg7 commented 8 years ago

Clash on hasProperty:

export interface Map<M extends ReadOnly, T> {
    [index: string]: T ;
}

/*@ qualif HSqualif(s: Str, v: a): hasProperty v s */
/*@ qualif EPqualif(s: Str, v: a): enumProp v s */

/*@ sum :: (array: IArray<{ (Immutable) {[s:string]:number} | hasProperty v prop }>, prop: string) => number */
export function sum(array: any[], prop: string): number {
    let result = 0;
    for (let i = 0; i < array.length; i++) {
        result += <number>(array[i][prop]);
    }
    return result;
}

/*@ hasProperty :: <M extends ReadOnly, T>(map: Map<M,T>, key: string) => { boolean | Prop(v) <=> (hasDirectProperty map key && hasProperty map key) } */
export declare function hasProperty<M extends ReadOnly, TT>(map: Map<M, TT>, key: string): boolean;