TypeScript/tests/baselines/reference/duplicateVariablesByScope.types

73 lines
2.4 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/duplicateVariablesByScope.ts ===
// duplicate local variables are only reported at global scope
module M {
2015-04-13 23:01:57 +02:00
>M : typeof M, Symbol(M, Decl(duplicateVariablesByScope.ts, 0, 0))
2014-08-15 23:33:16 +02:00
for (var j = 0; j < 10; j++) {
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
>j < 10 : boolean
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2015-04-13 21:36:11 +02:00
>10 : number
2014-08-15 23:33:16 +02:00
>j++ : number
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2014-08-15 23:33:16 +02:00
}
for (var j = 0; j < 10; j++) {
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
>j < 10 : boolean
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2015-04-13 21:36:11 +02:00
>10 : number
2014-08-15 23:33:16 +02:00
>j++ : number
2015-04-13 23:01:57 +02:00
>j : number, Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
2014-08-15 23:33:16 +02:00
}
}
function foo() {
2015-04-13 23:01:57 +02:00
>foo : () => void, Symbol(foo, Decl(duplicateVariablesByScope.ts, 8, 1))
2014-08-15 23:33:16 +02:00
var x = 2;
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7))
2015-04-13 21:36:11 +02:00
>2 : number
2014-08-15 23:33:16 +02:00
var x = 1;
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
if (true) {
2015-04-13 21:36:11 +02:00
>true : boolean
2014-08-15 23:33:16 +02:00
var result = 1;
2015-04-13 23:01:57 +02:00
>result : number, Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
}
else {
var result = 2;
2015-04-13 23:01:57 +02:00
>result : number, Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11))
2015-04-13 21:36:11 +02:00
>2 : number
2014-08-15 23:33:16 +02:00
}
}
class C {
2015-04-13 23:01:57 +02:00
>C : C, Symbol(C, Decl(duplicateVariablesByScope.ts, 19, 1))
2014-08-15 23:33:16 +02:00
foo() {
2015-04-13 23:01:57 +02:00
>foo : () => void, Symbol(foo, Decl(duplicateVariablesByScope.ts, 21, 9))
2014-08-15 23:33:16 +02:00
try {
var x = 1;
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
}
catch (e) {
2015-04-13 23:01:57 +02:00
>e : any, Symbol(e, Decl(duplicateVariablesByScope.ts, 26, 15))
2014-08-15 23:33:16 +02:00
var x = 2;
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15))
2015-04-13 21:36:11 +02:00
>2 : number
2014-08-15 23:33:16 +02:00
}
}
}