* 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
115 lines
1.6 KiB
Plaintext
115 lines
1.6 KiB
Plaintext
=== tests/cases/compiler/newOperator.ts ===
|
|
interface ifc { }
|
|
>ifc : ifc
|
|
|
|
// Attempting to 'new' an interface yields poor error
|
|
var i = new ifc();
|
|
>i : any
|
|
>new ifc() : any
|
|
>ifc : any
|
|
|
|
// Parens are optional
|
|
var x = new Date;
|
|
>x : Date
|
|
>new Date : Date
|
|
>Date : DateConstructor
|
|
|
|
var y = new Date();
|
|
>y : Date
|
|
>new Date() : Date
|
|
>Date : DateConstructor
|
|
|
|
// Target is not a class or var, good error
|
|
var t1 = new 53();
|
|
>t1 : any
|
|
>new 53() : any
|
|
>53 : 53
|
|
|
|
var t2 = new ''();
|
|
>t2 : any
|
|
>new ''() : any
|
|
>'' : ""
|
|
|
|
new string;
|
|
>new string : any
|
|
>string : any
|
|
|
|
// Use in LHS of expression?
|
|
(new Date()).toString();
|
|
>(new Date()).toString() : string
|
|
>(new Date()).toString : () => string
|
|
>(new Date()) : Date
|
|
>new Date() : Date
|
|
>Date : DateConstructor
|
|
>toString : () => string
|
|
|
|
// Various spacing
|
|
var t3 = new string[]( );
|
|
>t3 : any
|
|
>new string[]( ) : any
|
|
>string[] : any
|
|
>string : any
|
|
|
|
var t4 =
|
|
>t4 : any
|
|
|
|
new
|
|
>newstring[ ] ( ) : any
|
|
|
|
string
|
|
>string[ ] : any
|
|
>string : any
|
|
|
|
[
|
|
]
|
|
(
|
|
);
|
|
|
|
// Unresolved symbol
|
|
var f = new q();
|
|
>f : any
|
|
>new q() : any
|
|
>q : any
|
|
|
|
// not legal
|
|
var t5 = new new Date;
|
|
>t5 : any
|
|
>new new Date : any
|
|
>new Date : Date
|
|
>Date : DateConstructor
|
|
|
|
// Can be an expression
|
|
new String;
|
|
>new String : String
|
|
>String : StringConstructor
|
|
|
|
|
|
module M {
|
|
>M : typeof M
|
|
|
|
export class T {
|
|
>T : T
|
|
|
|
x: number;
|
|
>x : number
|
|
}
|
|
}
|
|
|
|
class S {
|
|
>S : S
|
|
|
|
public get xs(): M.T[] {
|
|
>xs : M.T[]
|
|
>M : any
|
|
>T : M.T
|
|
|
|
return new M.T[];
|
|
>new M.T[] : any
|
|
>M.T[] : any
|
|
>M.T : typeof M.T
|
|
>M : typeof M
|
|
>T : typeof M.T
|
|
}
|
|
}
|
|
|