* Always generate type & symbol baselines * Accept changed shadowed baselines * Accept brand new type and symbol baselines * Allow `getTypeAtLocation` to return undefined in the type writer * Accept baselines which had missing type information * Bind container for dynamically names enum members so they may be printed * Accept type/symbol baselines for enums with computed members * First pass at reducing typeWriter memory overhead * Use generators to allow for type and symbol baselines with no cache * Accept new baselines for tests whose output was fixed by better newline splitting * Hard cap on number of declarations printed, cache declaration print text * handle differing newlines better still to handle RWC newlines * Lower abridging count, accept abridged baselines * Limit max RWC error output size, limit RWC type and symbol baseline input size * Move skip logic into type and symbol baseliner to streamline error handling * Accept removal of empty baselines * Canonicalize path earlier to handle odd paths in input files * Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another * No need to pathify again
110 lines
3.4 KiB
Plaintext
110 lines
3.4 KiB
Plaintext
=== tests/cases/conformance/ambient/ambientErrors.ts ===
|
|
// Ambient variable with an initializer
|
|
declare var x = 4;
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 1, 11))
|
|
|
|
// Ambient functions with invalid overloads
|
|
declare function fn(x: number): string;
|
|
>fn : Symbol(fn, Decl(ambientErrors.ts, 1, 18), Decl(ambientErrors.ts, 4, 39))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 4, 20))
|
|
|
|
declare function fn(x: 'foo'): number;
|
|
>fn : Symbol(fn, Decl(ambientErrors.ts, 1, 18), Decl(ambientErrors.ts, 4, 39))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 5, 20))
|
|
|
|
// Ambient functions with duplicate signatures
|
|
declare function fn1(x: number): string;
|
|
>fn1 : Symbol(fn1, Decl(ambientErrors.ts, 5, 38), Decl(ambientErrors.ts, 8, 40))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 8, 21))
|
|
|
|
declare function fn1(x: number): string;
|
|
>fn1 : Symbol(fn1, Decl(ambientErrors.ts, 5, 38), Decl(ambientErrors.ts, 8, 40))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 9, 21))
|
|
|
|
// Ambient function overloads that differ only by return type
|
|
declare function fn2(x: number): string;
|
|
>fn2 : Symbol(fn2, Decl(ambientErrors.ts, 9, 40), Decl(ambientErrors.ts, 12, 40))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 12, 21))
|
|
|
|
declare function fn2(x: number): number;
|
|
>fn2 : Symbol(fn2, Decl(ambientErrors.ts, 9, 40), Decl(ambientErrors.ts, 12, 40))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 13, 21))
|
|
|
|
// Ambient function with default parameter values
|
|
declare function fn3(x = 3);
|
|
>fn3 : Symbol(fn3, Decl(ambientErrors.ts, 13, 40))
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 16, 21))
|
|
|
|
// Ambient function with function body
|
|
declare function fn4() { };
|
|
>fn4 : Symbol(fn4, Decl(ambientErrors.ts, 16, 28))
|
|
|
|
// Ambient enum with non - integer literal constant member
|
|
declare enum E1 {
|
|
>E1 : Symbol(E1, Decl(ambientErrors.ts, 19, 27))
|
|
|
|
y = 4.23
|
|
>y : Symbol(E1.y, Decl(ambientErrors.ts, 22, 17))
|
|
}
|
|
|
|
// Ambient enum with computer member
|
|
declare enum E2 {
|
|
>E2 : Symbol(E2, Decl(ambientErrors.ts, 24, 1))
|
|
|
|
x = 'foo'.length
|
|
>x : Symbol(E2.x, Decl(ambientErrors.ts, 27, 17))
|
|
>'foo'.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
|
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
|
}
|
|
|
|
// Ambient module with initializers for values, bodies for functions / classes
|
|
declare module M1 {
|
|
>M1 : Symbol(M1, Decl(ambientErrors.ts, 29, 1))
|
|
|
|
var x = 3;
|
|
>x : Symbol(x, Decl(ambientErrors.ts, 33, 7))
|
|
|
|
function fn() { }
|
|
>fn : Symbol(fn, Decl(ambientErrors.ts, 33, 14))
|
|
|
|
class C {
|
|
>C : Symbol(C, Decl(ambientErrors.ts, 34, 21))
|
|
|
|
static x = 3;
|
|
>x : Symbol(C.x, Decl(ambientErrors.ts, 35, 13))
|
|
|
|
y = 4;
|
|
>y : Symbol(C.y, Decl(ambientErrors.ts, 36, 21))
|
|
|
|
constructor() { }
|
|
fn() { }
|
|
>fn : Symbol(C.fn, Decl(ambientErrors.ts, 38, 25))
|
|
|
|
static sfn() { }
|
|
>sfn : Symbol(C.sfn, Decl(ambientErrors.ts, 39, 16))
|
|
}
|
|
}
|
|
|
|
// Ambient external module not in the global module
|
|
module M2 {
|
|
>M2 : Symbol(M2, Decl(ambientErrors.ts, 42, 1))
|
|
|
|
declare module 'nope' { }
|
|
}
|
|
|
|
// Ambient external module with a string literal name that isn't a top level external module name
|
|
declare module '../foo' { }
|
|
|
|
// Ambient external module with export assignment and other exported members
|
|
declare module 'bar' {
|
|
var n;
|
|
>n : Symbol(n, Decl(ambientErrors.ts, 54, 7))
|
|
|
|
export var q;
|
|
>q : Symbol(q, Decl(ambientErrors.ts, 55, 14))
|
|
|
|
export = n;
|
|
>n : Symbol(n, Decl(ambientErrors.ts, 54, 7))
|
|
}
|
|
|