143 lines
2.4 KiB
Text
143 lines
2.4 KiB
Text
=== tests/cases/compiler/collisionRestParameterClassConstructor.ts ===
|
|
// Constructors
|
|
class c1 {
|
|
>c1 : c1
|
|
|
|
constructor(_i: number, ...restParameters) { //_i is error
|
|
>_i : number
|
|
>restParameters : any[]
|
|
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
class c1NoError {
|
|
>c1NoError : c1NoError
|
|
|
|
constructor(_i: number) { // no error
|
|
>_i : number
|
|
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
|
|
class c2 {
|
|
>c2 : c2
|
|
|
|
constructor(...restParameters) {
|
|
>restParameters : any[]
|
|
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
class c2NoError {
|
|
>c2NoError : c2NoError
|
|
|
|
constructor() {
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
|
|
class c3 {
|
|
>c3 : c3
|
|
|
|
constructor(public _i: number, ...restParameters) { //_i is error
|
|
>_i : number
|
|
>restParameters : any[]
|
|
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
class c3NoError {
|
|
>c3NoError : c3NoError
|
|
|
|
constructor(public _i: number) { // no error
|
|
>_i : number
|
|
|
|
var _i = 10; // no error
|
|
>_i : number
|
|
>10 : number
|
|
}
|
|
}
|
|
|
|
declare class c4 {
|
|
>c4 : c4
|
|
|
|
constructor(_i: number, ...restParameters); // No error - no code gen
|
|
>_i : number
|
|
>restParameters : any[]
|
|
}
|
|
declare class c4NoError {
|
|
>c4NoError : c4NoError
|
|
|
|
constructor(_i: number); // no error
|
|
>_i : number
|
|
}
|
|
|
|
class c5 {
|
|
>c5 : c5
|
|
|
|
constructor(_i: number, ...rest); // no codegen no error
|
|
>_i : number
|
|
>rest : any[]
|
|
|
|
constructor(_i: string, ...rest); // no codegen no error
|
|
>_i : string
|
|
>rest : any[]
|
|
|
|
constructor(_i: any, ...rest) { // error
|
|
>_i : any
|
|
>rest : any[]
|
|
|
|
var _i: any; // no error
|
|
>_i : any
|
|
}
|
|
}
|
|
|
|
class c5NoError {
|
|
>c5NoError : c5NoError
|
|
|
|
constructor(_i: number); // no error
|
|
>_i : number
|
|
|
|
constructor(_i: string); // no error
|
|
>_i : string
|
|
|
|
constructor(_i: any) { // no error
|
|
>_i : any
|
|
|
|
var _i: any; // no error
|
|
>_i : any
|
|
}
|
|
}
|
|
|
|
declare class c6 {
|
|
>c6 : c6
|
|
|
|
constructor(_i: number, ...rest); // no codegen no error
|
|
>_i : number
|
|
>rest : any[]
|
|
|
|
constructor(_i: string, ...rest); // no codegen no error
|
|
>_i : string
|
|
>rest : any[]
|
|
}
|
|
|
|
declare class c6NoError {
|
|
>c6NoError : c6NoError
|
|
|
|
constructor(_i: number); // no error
|
|
>_i : number
|
|
|
|
constructor(_i: string); // no error
|
|
>_i : string
|
|
}
|