Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzzen committed Sep 27, 2023
1 parent 54183fd commit ff025b3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41191,7 +41191,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
if (checkUninitialized) {
if (checkUnused) {
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/unusedLocalsInMethod4.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ unusedLocalsInMethod4.ts(57,9): error TS2454: Variable 'x' is used before being
}

function f3() {
let x: number[];
let x: number[]; // should error
~
!!! error TS2454: Variable 'x' is used before being assigned.
function foo() {
Expand All @@ -97,7 +97,7 @@ unusedLocalsInMethod4.ts(57,9): error TS2454: Variable 'x' is used before being
}

function f4() {
let x: number;
let x: number; // should error
~
!!! error TS2454: Variable 'x' is used before being assigned.
return {
Expand All @@ -107,7 +107,7 @@ unusedLocalsInMethod4.ts(57,9): error TS2454: Variable 'x' is used before being
};
}

declare let x: number;
declare let x: number; // should error
function f5() {
x.toString();
}
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/unusedLocalsInMethod4.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ function f2<T, NonNull extends {}>() {
}

function f3() {
let x: number[];
let x: number[]; // should error
function foo() {
x.toString();
}
foo();
}

function f4() {
let x: number;
let x: number; // should error
return {
foo() {
return x.toString();
}
};
}

declare let x: number;
declare let x: number; // should error
function f5() {
x.toString();
}
Expand Down Expand Up @@ -120,14 +120,14 @@ function f2() {
console.log(x9);
}
function f3() {
var x;
var x; // should error
function foo() {
x.toString();
}
foo();
}
function f4() {
var x;
var x; // should error
return {
foo: function () {
return x.toString();
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/unusedLocalsInMethod4.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function f2<T, NonNull extends {}>() {
function f3() {
>f3 : Symbol(f3, Decl(unusedLocalsInMethod4.ts, 45, 1))

let x: number[];
let x: number[]; // should error
>x : Symbol(x, Decl(unusedLocalsInMethod4.ts, 48, 7))

function foo() {
Expand All @@ -206,7 +206,7 @@ function f3() {
function f4() {
>f4 : Symbol(f4, Decl(unusedLocalsInMethod4.ts, 53, 1))

let x: number;
let x: number; // should error
>x : Symbol(x, Decl(unusedLocalsInMethod4.ts, 56, 7))

return {
Expand All @@ -221,7 +221,7 @@ function f4() {
};
}

declare let x: number;
declare let x: number; // should error
>x : Symbol(x, Decl(unusedLocalsInMethod4.ts, 64, 11))

function f5() {
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/unusedLocalsInMethod4.types
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function f2<T, NonNull extends {}>() {
function f3() {
>f3 : () => void

let x: number[];
let x: number[]; // should error
>x : number[]

function foo() {
Expand All @@ -219,7 +219,7 @@ function f3() {
function f4() {
>f4 : () => { foo(): string; }

let x: number;
let x: number; // should error
>x : number

return {
Expand All @@ -237,7 +237,7 @@ function f4() {
};
}

declare let x: number;
declare let x: number; // should error
>x : number

function f5() {
Expand Down

0 comments on commit ff025b3

Please sign in to comment.